diff options
author | Kevin B Kenny <kennykb@acm.org> | 2004-09-27 14:31:14 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2004-09-27 14:31:14 (GMT) |
commit | b2ddd5afb45d64091bc8d01b2b113523ffd74d45 (patch) | |
tree | 8b6c18227f33530b862fb4e7970c41ca4d140197 /unix | |
parent | 7ce488b19c3bc7061ea8976f1672952b4f5fd1c7 (diff) | |
download | tcl-b2ddd5afb45d64091bc8d01b2b113523ffd74d45.zip tcl-b2ddd5afb45d64091bc8d01b2b113523ffd74d45.tar.gz tcl-b2ddd5afb45d64091bc8d01b2b113523ffd74d45.tar.bz2 |
many more TIP 173 changes
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixTime.c | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 6def210..32cea2d 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixTime.c,v 1.21 2004/05/14 21:43:29 kennykb Exp $ + * RCS: @(#) $Id: tclUnixTime.c,v 1.22 2004/09/27 14:31:20 kennykb Exp $ */ #include "tclInt.h" @@ -289,61 +289,6 @@ TclpGetDate(time, useGMT) /* *---------------------------------------------------------------------- * - * TclpStrftime -- - * - * On Unix, we can safely call the native strftime implementation, - * and also ignore the useGMT parameter. - * - * Results: - * Returns the number of Unicode code points in the result string. - * - * - * Side effects: - * Stores the converted time in the buffer designated by the - * 's' parameter. - * - *---------------------------------------------------------------------- - */ - -size_t -TclpStrftime(s, maxsize, format, t, useGMT) - char *s; /* Buffer to receive the formatted string */ - size_t maxsize; /* Allocated length of the buffer */ - CONST char *format; /* Format to use for the conversion */ - CONST struct tm *t; /* Time to convert */ - int useGMT; /* Flag == 1 if converting in UTC */ -{ - Tcl_DString utf8Buffer; - size_t status; - char* utf8Format; - 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)); - } else { - Tcl_DStringInit( &utf8Buffer ); - utf8Format = Tcl_UtfToExternalDString( NULL, format, -1, &utf8Buffer ); - setlocale(LC_TIME, ""); - status = strftime( s, maxsize, utf8Format, t ); - Tcl_DStringFree( &utf8Buffer ); - if ( status > 0 ) { - Tcl_DStringInit ( &utf8Buffer ); - Tcl_ExternalToUtfDString( NULL, s, (int) status, &utf8Buffer ); - strcpy( s, Tcl_DStringValue( &utf8Buffer ) ); - Tcl_DStringFree( &utf8Buffer ); - } - return status; - } - -} - -/* - *---------------------------------------------------------------------- - * * TclpGmtime -- * * Wrapper around the 'gmtime' library function to make it thread |