summaryrefslogtreecommitdiffstats
path: root/compat/strftime.c
diff options
context:
space:
mode:
authorericm <ericm>2000-01-14 22:15:51 (GMT)
committerericm <ericm>2000-01-14 22:15:51 (GMT)
commit35d4ffd9a74d652788b42a6c8300dbf3c2a62eb6 (patch)
treebe858120ee7933f92e52d0b4138f6d4636c6f151 /compat/strftime.c
parent72978d2b3dc58e62e08e27987a2ad2fbe01e04d9 (diff)
downloadtcl-35d4ffd9a74d652788b42a6c8300dbf3c2a62eb6.zip
tcl-35d4ffd9a74d652788b42a6c8300dbf3c2a62eb6.tar.gz
tcl-35d4ffd9a74d652788b42a6c8300dbf3c2a62eb6.tar.bz2
* unix/tclUnixTime.c: New clock format format.
* compat/strftime.c: New clock format format. * generic/tclGetDate.y: New clock scan format.
Diffstat (limited to 'compat/strftime.c')
-rw-r--r--compat/strftime.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/compat/strftime.c b/compat/strftime.c
index bb8ea52..1c14ca8 100644
--- a/compat/strftime.c
+++ b/compat/strftime.c
@@ -8,7 +8,7 @@
* source. See the copyright notice below for details on redistribution
* restrictions. The "license.terms" file does not apply to this file.
*
- * RCS: @(#) $Id: strftime.c,v 1.5 1999/07/22 01:26:18 redman Exp $
+ * RCS: @(#) $Id: strftime.c,v 1.6 2000/01/14 22:15:51 ericm Exp $
*/
/*
@@ -45,7 +45,7 @@
*/
#if defined(LIBC_SCCS)
-static char *rcsid = "$Id: strftime.c,v 1.5 1999/07/22 01:26:18 redman Exp $";
+static char *rcsid = "$Id: strftime.c,v 1.6 2000/01/14 22:15:51 ericm Exp $";
#endif /* LIBC_SCCS */
#include <time.h>
@@ -111,6 +111,16 @@ TclpStrftime(s, maxsize, format, t)
const char *format;
const struct tm *t;
{
+ if (format[0] == '%' && format[1] == 'Q') {
+ /* Format as a stardate */
+ sprintf(s, "Stardate %2d%03d.%01d",
+ (((t->tm_year + TM_YEAR_BASE) + 377) - 2323),
+ (((t->tm_yday + 1) * 1000) /
+ (365 + IsLeapYear((t->tm_year + TM_YEAR_BASE)))),
+ (((t->tm_hour * 60) + t->tm_min)/144));
+ return(strlen(s));
+ }
+
tzset();
pt = s;