aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-12-04 20:58:15 +0000
committerUlrich Drepper <drepper@redhat.com>1998-12-04 20:58:15 +0000
commita6ff34d7b0b59a1ad501dca25558ba21f6e539bb (patch)
treeeabe576c69bb878112d903d1e08836bab8c8aed1 /time
parentfcb7e0a5f7722609d78739d8ef590fcfd2ed2109 (diff)
downloadglibc-a6ff34d7b0b59a1ad501dca25558ba21f6e539bb.zip
glibc-a6ff34d7b0b59a1ad501dca25558ba21f6e539bb.tar.gz
glibc-a6ff34d7b0b59a1ad501dca25558ba21f6e539bb.tar.bz2
Update.
1998-12-04 Ulrich Drepper <drepper@cygnus.com> * argp/argp.h: Add __retrict. * dirent/dirent.h: Likewise. * elf/dlfcn.h: Likewise. * grp/grp.h: Likewise. * iconv/iconv.h: Likewise. * inet/aliases.h: Likewise. * libio/libio.h: Likewise. * libio/stdio.h: Likewise. * locale/locale.h: Likewise. * misc/mntent.h: Likewise. * posix/wordexp.h: Likewise. * pwd/pwd.h: Likewise. * resolv/netdb.h: Likewise. * rt/aio.h: Likewise. * stdio-common/printf.h: Likewise. * stdlib/monetary.h: Likewise. * stdlib/stdlib.h: Likewise. * string/argz.h: Likewise. * string/envz.h: Likewise. * string/string.h: Likewise. * time/time.h: Likewise. 1998-12-04 Zack Weinberg <zack@rabi.phys.columbia.edu> * misc/sys/cdefs.h: Only include features.h if _FEATURES_H isn't defined. gcc's redundant include optimizer isn't clever enough to prevent a reinclusion here. Define __restrict to the empty string only if not GCC or GCC version less than 2.92. 1998-12-03 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/configure.in: Fix last change. 1998-12-03 Mark Kettenis <kettenis@phys.uva.nl> * time/strptime.c (strptime_internal): Make use of `%C' format specifier if it is seen together with the `%y' specifier. 1998-12-04 Ulrich Drepper <drepper@cygnus.com> * po/sk.po: New file. 1998-12-03 Scott Bambrough <scottb@corelcomputer.com> * sysdeps/arm/dl-machine.h (dl_start_user): Incorrect address for _dl_main_searchlist passed to _dl_init_next. 1998-12-02 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * math/libm-test.c: Expand literal tabs in strings. Normalize whitespace. 1998-12-02 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/sys/fsuid.h: Fix spelling.
Diffstat (limited to 'time')
-rw-r--r--time/strptime.c11
-rw-r--r--time/time.h21
2 files changed, 22 insertions, 10 deletions
diff --git a/time/strptime.c b/time/strptime.c
index d126b14..a26da5a 100644
--- a/time/strptime.c
+++ b/time/strptime.c
@@ -203,10 +203,13 @@ strptime_internal (buf, format, tm, decided)
int cnt;
size_t val;
int have_I, is_pm;
+ int century, want_century;
rp = buf;
fmt = format;
have_I = is_pm = 0;
+ century = -1;
+ want_century = 0;
while (*fmt != '\0')
{
@@ -343,7 +346,7 @@ strptime_internal (buf, format, tm, decided)
case 'C':
/* Match century number. */
get_number (0, 99);
- /* We don't need the number. */
+ century = val;
break;
case 'd':
case 'e':
@@ -548,11 +551,14 @@ strptime_internal (buf, format, tm, decided)
/* The "Year 2000 :The Millennium Rollover" paper suggests that
values in the range 69-99 refer to the twentieth century. */
tm->tm_year = val >= 69 ? val : val + 100;
+ /* Indicate that we want to use the century, if specified
+ want_century = 1;
break;
case 'Y':
/* Match year including century number. */
get_number (0, 9999);
tm->tm_year = val - 1900;
+ want_century = 0;
break;
case 'Z':
/* XXX How to handle this? */
@@ -725,6 +731,9 @@ strptime_internal (buf, format, tm, decided)
if (have_I && is_pm)
tm->tm_hour += 12;
+ if (want_century && century != -1)
+ tm->tm_year = tm->tm_year % 100 + (century - 19) * 100;
+
return (char *) rp;
}
diff --git a/time/time.h b/time/time.h
index 3748852..08b1da2 100644
--- a/time/time.h
+++ b/time/time.h
@@ -214,15 +214,15 @@ extern struct tm *localtime __P ((__const time_t *__timer));
# if defined __USE_POSIX || defined __USE_MISC
/* Return the `struct tm' representation of *TIMER in UTC,
using *TP to store the result. */
-extern struct tm *__gmtime_r __P ((__const time_t *__timer,
- struct tm *__tp));
-extern struct tm *gmtime_r __P ((__const time_t *__timer,
- struct tm *__tp));
+extern struct tm *__gmtime_r __P ((__const time_t *__restrict __timer,
+ struct tm *__restrict __tp));
+extern struct tm *gmtime_r __P ((__const time_t *__restrict __timer,
+ struct tm *__restrict __tp));
/* Return the `struct tm' representation of *TIMER in local time,
using *TP to store the result. */
-extern struct tm *localtime_r __P ((__const time_t *__timer,
- struct tm *__tp));
+extern struct tm *localtime_r __P ((__const time_t *__restrict __timer,
+ struct tm *__restrict __tp));
# endif /* POSIX or misc */
/* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n"
@@ -237,10 +237,12 @@ extern char *ctime __P ((__const time_t *__timer));
/* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n"
that is the representation of TP in this format. */
-extern char *asctime_r __P ((__const struct tm *__tp, char *__buf));
+extern char *asctime_r __P ((__const struct tm *__restrict __tp,
+ char *__restrict __buf));
/* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */
-extern char *ctime_r __P ((__const time_t *__timer, char *__buf));
+extern char *ctime_r __P ((__const time_t *__restrict __timer,
+ char *__restrict __buf));
# endif /* POSIX or misc */
@@ -326,7 +328,8 @@ extern struct tm *getdate __P ((__const char *__string));
variant. The functionality is the same. The result is returned in
the buffer pointed to by RESBUFP and in case of an error the return
value is != 0 with the same values as given above for `getdate_err'. */
-extern int getdate_r __P ((__const char *__string, struct tm *__resbufp));
+extern int getdate_r __P ((__const char *__restrict __string,
+ struct tm *__restrict __resbufp));
# endif