diff options
author | ericm <ericm@noemail.net> | 2000-01-14 22:15:51 (GMT) |
---|---|---|
committer | ericm <ericm@noemail.net> | 2000-01-14 22:15:51 (GMT) |
commit | e3f3396272e84adcbdce1a8ba782c1dfa94f9aa4 (patch) | |
tree | be858120ee7933f92e52d0b4138f6d4636c6f151 /compat | |
parent | 94075f8b2dd1683ecc7ac0d651209caf5ba82aea (diff) | |
download | tcl-e3f3396272e84adcbdce1a8ba782c1dfa94f9aa4.zip tcl-e3f3396272e84adcbdce1a8ba782c1dfa94f9aa4.tar.gz tcl-e3f3396272e84adcbdce1a8ba782c1dfa94f9aa4.tar.bz2 |
* unix/tclUnixTime.c: New clock format format.
* compat/strftime.c: New clock format format.
* generic/tclGetDate.y: New clock scan format.
FossilOrigin-Name: 53023d030d3ce288ed929ac8fad6c03646e458c3
Diffstat (limited to 'compat')
-rw-r--r-- | compat/strftime.c | 14 |
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; |