diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-08-13 05:45:20 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-08-13 05:45:20 +0000 |
commit | 65a5162550f58047974793cdc8067a970b2435c0 (patch) | |
tree | 082bb7d5568f3b2e36e3fe166e9f3039394fcf44 /missing/strftime.c | |
parent | fcd020c83028f5610d382e85a2df00223e12bd7e (diff) |
1.4.0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'missing/strftime.c')
-rw-r--r-- | missing/strftime.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/missing/strftime.c b/missing/strftime.c index 478471c37d..cc3f1a8070 100644 --- a/missing/strftime.c +++ b/missing/strftime.c @@ -45,6 +45,8 @@ * January 1996 */ +#include "config.h" + #ifndef GAWK #include <stdio.h> #include <ctype.h> @@ -92,23 +94,25 @@ #ifndef __STDC__ #define const /**/ -extern void *malloc(); -extern void *realloc(); extern void tzset(); -extern char *strchr(); -extern char *getenv(); static int weeknumber(); adddecl(static int iso8601wknum();) #else -extern void *malloc(unsigned count); -extern void *realloc(void *ptr, unsigned count); extern void tzset(void); -extern char *strchr(const char *str, int ch); -extern char *getenv(const char *v); static int weeknumber(const struct tm *timeptr, int firstweekday); adddecl(static int iso8601wknum(const struct tm *timeptr);) #endif +#ifdef STDC_HEADERS +#include <stdlib.h> +#include <string.h> +#else +extern void *malloc(); +extern void *realloc(); +extern char *getenv(); +extern char *strchr(); +#endif + #ifdef __GNUC__ #define inline __inline__ #else @@ -348,8 +352,8 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr) strcpy(tbuf, ampm[1]); break; - case 'S': /* second, 00 - 61 */ - i = range(0, timeptr->tm_sec, 61); + case 'S': /* second, 00 - 60 */ + i = range(0, timeptr->tm_sec, 60); sprintf(tbuf, "%02d", i); break; @@ -504,7 +508,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr) #ifdef VMS_EXT case 'v': /* date as dd-bbb-YYYY */ - sprintf(tbuf, "%02d-%3.3s-%4d", + sprintf(tbuf, "%2d-%3.3s-%4d", range(1, timeptr->tm_mday, 31), months_a[range(0, timeptr->tm_mon, 11)], timeptr->tm_year + 1900); @@ -562,7 +566,7 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *timeptr) else sprintf(tbuf, "%02d", y % 100); break; -#endif ISO_DATE_EXT +#endif /* ISO_DATE_EXT */ default: tbuf[0] = '%'; tbuf[1] = *format; @@ -826,7 +830,7 @@ static char *array[] = "(%%M) minute (00..59) %M", "(%%O) Locale extensions (ignored) %O", "(%%R) time, 24-hour (%%H:%%M) %R", - "(%%S) second (00..61) %S", + "(%%S) second (00..60) %S", "(%%T) time, 24-hour (%%H:%%M:%%S) %T", "(%%U) week of year, Sunday as first day of week (00..53) %U", "(%%V) week of year according to ISO 8601 %V", |