diff options
Diffstat (limited to 'time')
-rw-r--r-- | time/asctime.c | 34 | ||||
-rw-r--r-- | time/dysize.c | 28 | ||||
-rw-r--r-- | time/gmtime.c | 34 | ||||
-rw-r--r-- | time/offtime.c | 41 | ||||
-rw-r--r-- | time/strptime.c | 2 | ||||
-rw-r--r-- | time/timegm.c | 28 | ||||
-rw-r--r-- | time/tzset.c | 60 |
7 files changed, 114 insertions, 113 deletions
diff --git a/time/asctime.c b/time/asctime.c index 25bc9de04c..82e9f72f3f 100644 --- a/time/asctime.c +++ b/time/asctime.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ +/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include "../locale/localeinfo.h" #include <errno.h> diff --git a/time/dysize.c b/time/dysize.c index 1f8f624556..a53ec7ba07 100644 --- a/time/dysize.c +++ b/time/dysize.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1994 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1994, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <time.h> diff --git a/time/gmtime.c b/time/gmtime.c index 364b4c9262..f9627e7b62 100644 --- a/time/gmtime.c +++ b/time/gmtime.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ +/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <stddef.h> #include <time.h> diff --git a/time/offtime.c b/time/offtime.c index 4e062df0d3..1469029bc0 100644 --- a/time/offtime.c +++ b/time/offtime.c @@ -1,26 +1,25 @@ -/* Copyright (C) 1991, 1993 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1991, 1993, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ -#include <ansidecl.h> #include <time.h> /* Defined in mktime.c. */ -extern CONST unsigned short int __mon_yday[2][13]; +extern const unsigned short int __mon_yday[2][13]; #define SECS_PER_HOUR (60 * 60) #define SECS_PER_DAY (SECS_PER_HOUR * 24) @@ -29,11 +28,13 @@ extern CONST unsigned short int __mon_yday[2][13]; offset OFFSET seconds east of UTC, and store year, yday, mon, mday, wday, hour, min, sec into *TP. */ void -DEFUN(__offtime, (t, offset, tp), - CONST time_t *t AND long int offset AND struct tm *tp) +__offtime (t, offset, tp) + const time_t *t; + long int offset; + struct tm *tp; { register long int days, rem, y; - register CONST unsigned short int *ip; + register const unsigned short int *ip; days = *t / SECS_PER_DAY; rem = *t % SECS_PER_DAY; @@ -58,7 +59,7 @@ DEFUN(__offtime, (t, offset, tp), tp->tm_wday += 7; y = 1970; -# define LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400) +#define LEAPS_THRU_END_OF(y) ((y) / 4 - (y) / 100 + (y) / 400) while (days < 0 || days >= (__isleap (y) ? 366 : 365)) { diff --git a/time/strptime.c b/time/strptime.c index ce3f4e3877..3340b4317c 100644 --- a/time/strptime.c +++ b/time/strptime.c @@ -129,7 +129,7 @@ localtime_r (t, tp) #endif #define recursive(new_fmt) \ (*(new_fmt) != '\0' \ - || strptime_internal (rp, (new_fmt), tm, decided) != NULL) + && strptime_internal (rp, (new_fmt), tm, decided) != NULL) #ifdef _LIBC diff --git a/time/timegm.c b/time/timegm.c index 4dd87f46d2..288065a7e5 100644 --- a/time/timegm.c +++ b/time/timegm.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1994 Free Software Foundation, Inc. -This file is part of the GNU C Library. +/* Copyright (C) 1994, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ #include <time.h> diff --git a/time/tzset.c b/time/tzset.c index 8d8be34405..87dc6d6337 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -229,41 +229,41 @@ __tzset_internal (always) tz += l; } + + /* Figure out the DST offset from GMT. */ + if (*tz == '-' || *tz == '+') + tz_rules[1].offset = *tz++ == '-' ? 1L : -1L; + else + tz_rules[1].offset = -1L; + + switch (sscanf (tz, "%hu:%hu:%hu", &hh, &mm, &ss)) + { + default: + /* Default to one hour later than standard time. */ + tz_rules[1].offset = tz_rules[0].offset + (60 * 60); + break; + + case 1: + mm = 0; + case 2: + ss = 0; + case 3: + tz_rules[1].offset *= (min (ss, 59) + (min (mm, 59) * 60) + + (min (hh, 23) * (60 * 60))); + break; + } + for (l = 0; l < 3; ++l) + { + while (isdigit (*tz)) + ++tz; + if (l < 2 && *tz == ':') + ++tz; + } } else /* There is no DST. */ tz_rules[1].name = tz_rules[0].name; - /* Figure out the DST offset from GMT. */ - if (*tz == '-' || *tz == '+') - tz_rules[1].offset = *tz++ == '-' ? 1L : -1L; - else - tz_rules[1].offset = -1L; - - switch (sscanf (tz, "%hu:%hu:%hu", &hh, &mm, &ss)) - { - default: - /* Default to one hour later than standard time. */ - tz_rules[1].offset = tz_rules[0].offset + (60 * 60); - break; - - case 1: - mm = 0; - case 2: - ss = 0; - case 3: - tz_rules[1].offset *= (min (ss, 59) + (min (mm, 59) * 60) + - (min (hh, 23) * (60 * 60))); - break; - } - for (l = 0; l < 3; ++l) - { - while (isdigit (*tz)) - ++tz; - if (l < 2 && *tz == ':') - ++tz; - } - done_names: if (*tz == '\0' || (tz[0] == ',' && tz[1] == '\0')) |