1 /* Copyright (C) 1991,92,93,94,95,96,97,98 Free Software Foundation, Inc.
3 NOTE: The canonical source of this file is maintained with the GNU C Library.
4 Bugs can be reported to bug-glibc@gnu.org.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25 /* Some hosts need this in order to declare localtime_r properly. */
31 # define HAVE_LIMITS_H 1
33 # define HAVE_MBRLEN 1
34 # define HAVE_STRUCT_ERA_ENTRY 1
35 # define HAVE_TM_GMTOFF 1
36 # define HAVE_TM_ZONE 1
37 # define HAVE_TZNAME 1
39 # define MULTIBYTE_IS_FORMAT_SAFE 1
40 # define STDC_HEADERS 1
41 # include "../locale/localeinfo.h"
44 #if defined emacs && !defined HAVE_BCOPY
45 # define HAVE_MEMCPY 1
49 #include <sys/types.h> /* Some systems define `time_t' here. */
51 #ifdef TIME_WITH_SYS_TIME
52 # include <sys/time.h>
55 # ifdef HAVE_SYS_TIME_H
56 # include <sys/time.h>
62 extern char *tzname
[];
65 /* Do multibyte processing if multibytes are supported, unless
66 multibyte sequences are safe in formats. Multibyte sequences are
67 safe if they cannot contain byte sequences that look like format
68 conversion specifications. The GNU C Library uses UTF8 multibyte
69 encoding, which is safe for formats, but strftime.c can be used
70 with other C libraries that use unsafe encodings. */
71 #define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)
77 /* Simulate mbrlen with mblen as best we can. */
78 # define mbstate_t int
79 # define mbrlen(s, n, ps) mblen (s, n)
80 # define mbsinit(ps) (*(ps) == 0)
82 static const mbstate_t mbstate_zero
;
95 # define memcpy(d, s, n) bcopy ((s), (d), (n))
100 # define MEMPCPY(d, s, n) __mempcpy (d, s, n)
102 # ifndef HAVE_MEMPCPY
103 # define MEMPCPY(d, s, n) ((void *) ((char *) memcpy (d, s, n) + (n)))
108 # if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
109 # define __P(args) args
111 # define __P(args) ()
113 #endif /* Not __P. */
131 #define TYPE_SIGNED(t) ((t) -1 < 0)
133 /* Bound on length of the string representing an integer value of type t.
134 Subtract one for the sign bit if t is signed;
135 302 / 1000 is log10 (2) rounded up;
136 add one for integer division truncation;
137 add one more for a minus sign if t is signed. */
138 #define INT_STRLEN_BOUND(t) \
139 ((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 100 + 1 + TYPE_SIGNED (t))
141 #define TM_YEAR_BASE 1900
144 /* Nonzero if YEAR is a leap year (every 4 years,
145 except every 100th isn't, and every 400th is). */
146 # define __isleap(year) \
147 ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
152 # define gmtime_r __gmtime_r
153 # define localtime_r __localtime_r
154 # define tzname __tzname
155 # define tzset __tzset
157 # if ! HAVE_LOCALTIME_R
158 # if ! HAVE_TM_GMTOFF
159 /* Approximate gmtime_r as best we can in its absence. */
161 # define gmtime_r my_gmtime_r
162 static struct tm
*gmtime_r
__P ((const time_t *, struct tm
*));
168 struct tm
*l
= gmtime (t
);
174 # endif /* ! HAVE_TM_GMTOFF */
176 /* Approximate localtime_r as best we can in its absence. */
178 # define localtime_r my_ftime_localtime_r
179 static struct tm
*localtime_r
__P ((const time_t *, struct tm
*));
185 struct tm
*l
= localtime (t
);
191 # endif /* ! HAVE_LOCALTIME_R */
192 #endif /* ! defined _LIBC */
195 #if !defined memset && !defined HAVE_MEMSET && !defined _LIBC
196 /* Some systems lack the `memset' function and we don't want to
197 introduce additional dependencies. */
198 /* The SGI compiler reportedly barfs on the trailing null
199 if we use a string constant as the initializer. 28 June 1997, rms. */
200 static const char spaces
[16] = /* " " */
201 { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
202 static const char zeroes
[16] = /* "0000000000000000" */
203 { '0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0' };
205 # define memset_space(P, Len) \
211 int _this = _len > 16 ? 16 : _len; \
212 (P) = MEMPCPY ((P), spaces, _this); \
218 # define memset_zero(P, Len) \
224 int _this = _len > 16 ? 16 : _len; \
225 (P) = MEMPCPY ((P), zeroes, _this); \
231 # define memset_space(P, Len) (memset ((P), ' ', (Len)), (P) += (Len))
232 # define memset_zero(P, Len) (memset ((P), '0', (Len)), (P) += (Len))
239 int _delta = width - _n; \
240 int _incr = _n + (_delta > 0 ? _delta : 0); \
241 if (i + _incr >= maxsize) \
248 memset_zero (p, _delta); \
250 memset_space (p, _delta); \
261 memcpy_lowcase (p, (s), _n); \
262 else if (to_uppcase) \
263 memcpy_uppcase (p, (s), _n); \
265 memcpy ((PTR) p, (PTR) (s), _n))
270 # define TOUPPER(Ch) toupper (Ch)
271 # define TOLOWER(Ch) tolower (Ch)
273 # define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch))
274 # define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
276 /* We don't use `isdigit' here since the locale dependent
277 interpretation is not what we want here. We only need to accept
278 the arabic digits in the ASCII range. One day there is perhaps a
279 more reliable way to accept other sets of digits. */
280 #define ISDIGIT(Ch) ((unsigned int) (Ch) - '0' <= 9)
282 static char *memcpy_lowcase
__P ((char *dest
, const char *src
, size_t len
));
285 memcpy_lowcase (dest
, src
, len
)
291 dest
[len
] = TOLOWER ((unsigned char) src
[len
]);
295 static char *memcpy_uppcase
__P ((char *dest
, const char *src
, size_t len
));
298 memcpy_uppcase (dest
, src
, len
)
304 dest
[len
] = TOUPPER ((unsigned char) src
[len
]);
310 /* Yield the difference between *A and *B,
311 measured in seconds, ignoring leap seconds. */
312 # define tm_diff ftime_tm_diff
313 static int tm_diff
__P ((const struct tm
*, const struct tm
*));
319 /* Compute intervening leap days correctly even if year is negative.
320 Take care to avoid int overflow in leap day calculations,
321 but it's OK to assume that A and B are close to each other. */
322 int a4
= (a
->tm_year
>> 2) + (TM_YEAR_BASE
>> 2) - ! (a
->tm_year
& 3);
323 int b4
= (b
->tm_year
>> 2) + (TM_YEAR_BASE
>> 2) - ! (b
->tm_year
& 3);
324 int a100
= a4
/ 25 - (a4
% 25 < 0);
325 int b100
= b4
/ 25 - (b4
% 25 < 0);
326 int a400
= a100
>> 2;
327 int b400
= b100
>> 2;
328 int intervening_leap_days
= (a4
- b4
) - (a100
- b100
) + (a400
- b400
);
329 int years
= a
->tm_year
- b
->tm_year
;
330 int days
= (365 * years
+ intervening_leap_days
331 + (a
->tm_yday
- b
->tm_yday
));
332 return (60 * (60 * (24 * days
+ (a
->tm_hour
- b
->tm_hour
))
333 + (a
->tm_min
- b
->tm_min
))
334 + (a
->tm_sec
- b
->tm_sec
));
336 #endif /* ! HAVE_TM_GMTOFF */
340 /* The number of days from the first day of the first ISO week of this
341 year to the year day YDAY with week day WDAY. ISO weeks start on
342 Monday; the first ISO week has the year's first Thursday. YDAY may
343 be as small as YDAY_MINIMUM. */
344 #define ISO_WEEK_START_WDAY 1 /* Monday */
345 #define ISO_WEEK1_WDAY 4 /* Thursday */
346 #define YDAY_MINIMUM (-366)
347 static int iso_week_days
__P ((int, int));
352 iso_week_days (yday
, wday
)
356 /* Add enough to the first operand of % to make it nonnegative. */
357 int big_enough_multiple_of_7
= (-YDAY_MINIMUM
/ 7 + 2) * 7;
359 - (yday
- wday
+ ISO_WEEK1_WDAY
+ big_enough_multiple_of_7
) % 7
360 + ISO_WEEK1_WDAY
- ISO_WEEK_START_WDAY
);
364 #if !(defined _NL_CURRENT || HAVE_STRFTIME)
365 static char const weekday_name
[][10] =
367 "Sunday", "Monday", "Tuesday", "Wednesday",
368 "Thursday", "Friday", "Saturday"
370 static char const month_name
[][10] =
372 "January", "February", "March", "April", "May", "June",
373 "July", "August", "September", "October", "November", "December"
379 # define my_strftime emacs_strftime
381 # define my_strftime strftime
384 #if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
385 /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
386 Work around this bug by copying *tp before it might be munged. */
387 size_t _strftime_copytm
__P ((char *, size_t, const char *,
390 my_strftime (s
, maxsize
, format
, tp
)
398 return _strftime_copytm (s
, maxsize
, format
, &tmcopy
);
401 # define my_strftime(S, Maxsize, Format, Tp) \
402 _strftime_copytm (S, Maxsize, Format, Tp)
406 /* Write information from TP into S according to the format
407 string FORMAT, writing no more that MAXSIZE characters
408 (including the terminating '\0') and returning number of
409 characters written. If S is NULL, nothing will be written
410 anywhere, so to determine how many characters would be
411 written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
413 my_strftime (s
, maxsize
, format
, tp
)
419 int hour12
= tp
->tm_hour
;
421 const char *const a_wkday
= _NL_CURRENT (LC_TIME
, ABDAY_1
+ tp
->tm_wday
);
422 const char *const f_wkday
= _NL_CURRENT (LC_TIME
, DAY_1
+ tp
->tm_wday
);
423 const char *const a_month
= _NL_CURRENT (LC_TIME
, ABMON_1
+ tp
->tm_mon
);
424 const char *const f_month
= _NL_CURRENT (LC_TIME
, MON_1
+ tp
->tm_mon
);
425 const char *const ampm
= _NL_CURRENT (LC_TIME
,
426 hour12
> 11 ? PM_STR
: AM_STR
);
427 size_t aw_len
= strlen (a_wkday
);
428 size_t am_len
= strlen (a_month
);
429 size_t ap_len
= strlen (ampm
);
432 const char *const f_wkday
= weekday_name
[tp
->tm_wday
];
433 const char *const f_month
= month_name
[tp
->tm_mon
];
434 const char *const a_wkday
= f_wkday
;
435 const char *const a_month
= f_month
;
436 const char *const ampm
= "AMPM" + 2 * (hour12
> 11);
442 #if defined _NL_CURRENT || !HAVE_STRFTIME
443 size_t wkday_len
= strlen (f_wkday
);
444 size_t month_len
= strlen (f_month
);
454 /* The POSIX test suite assumes that setting
455 the environment variable TZ to a new value before calling strftime()
456 will influence the result (the %Z format) even if the information in
457 TP is computed with a totally different time zone.
458 This is bogus: though POSIX allows bad behavior like this,
459 POSIX does not require it. Do the right thing instead. */
460 zone
= (const char *) tp
->tm_zone
;
463 /* POSIX.1 8.1.1 requires that whenever strftime() is called, the
464 time zone names contained in the external variable `tzname' shall
465 be set as if the tzset() function had been called. */
470 if (!(zone
&& *zone
) && tp
->tm_isdst
>= 0)
471 zone
= tzname
[tp
->tm_isdst
];
474 zone
= ""; /* POSIX.2 requires the empty string here. */
476 zonelen
= strlen (zone
);
481 if (hour12
== 0) hour12
= 12;
483 for (f
= format
; *f
!= '\0'; ++f
)
485 int pad
= 0; /* Padding for number ('-', '_', or 0). */
486 int modifier
; /* Field modifier ('E', 'O', or 0). */
487 int digits
; /* Max digits for numeric format. */
488 int number_value
; /* Numeric value to be printed. */
489 int negative_number
; /* 1 if the number is negative. */
492 char buf
[1 + (sizeof (int) < sizeof (time_t)
493 ? INT_STRLEN_BOUND (time_t)
494 : INT_STRLEN_BOUND (int))];
508 case '\a': case '\b': case '\t': case '\n':
509 case '\v': case '\f': case '\r':
510 case ' ': case '!': case '"': case '#': case '&': case'\'':
511 case '(': case ')': case '*': case '+': case ',': case '-':
512 case '.': case '/': case '0': case '1': case '2': case '3':
513 case '4': case '5': case '6': case '7': case '8': case '9':
514 case ':': case ';': case '<': case '=': case '>': case '?':
515 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
516 case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
517 case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
518 case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
519 case 'Y': case 'Z': case '[': case'\\': case ']': case '^':
520 case '_': case 'a': case 'b': case 'c': case 'd': case 'e':
521 case 'f': case 'g': case 'h': case 'i': case 'j': case 'k':
522 case 'l': case 'm': case 'n': case 'o': case 'p': case 'q':
523 case 'r': case 's': case 't': case 'u': case 'v': case 'w':
524 case 'x': case 'y': case 'z': case '{': case '|': case '}':
526 /* The C Standard requires these 98 characters (plus '%') to
527 be in the basic execution character set. None of these
528 characters can start a multibyte sequence, so they need
529 not be analyzed further. */
534 /* Copy this multibyte sequence until we reach its end, find
535 an error, or come back to the initial shift state. */
537 mbstate_t mbstate
= mbstate_zero
;
542 size_t bytes
= mbrlen (f
+ len
, (size_t) -1, &mbstate
);
547 if (bytes
== (size_t) -2 || bytes
== (size_t) -1)
555 while (! mbsinit (&mbstate
));
562 #else /* ! DO_MULTIBYTE */
564 /* Either multibyte encodings are not supported, or they are
565 safe for formats, so any non-'%' byte can be copied through. */
572 #endif /* ! DO_MULTIBYTE */
574 /* Check for flags that can modify a format. */
579 /* This influences the number formats. */
586 /* This changes textual output. */
600 /* As a GNU extension we allow to specify the field width. */
610 while (ISDIGIT (*f
));
613 /* Check for modifiers. */
626 /* Now do the specified format. */
630 #define DO_NUMBER(d, v) \
631 digits = width == -1 ? d : width; \
632 number_value = v; goto do_number
633 #define DO_NUMBER_SPACEPAD(d, v) \
634 digits = width == -1 ? d : width; \
635 number_value = v; goto do_number_spacepad
651 #if defined _NL_CURRENT || !HAVE_STRFTIME
652 cpy (aw_len
, a_wkday
);
655 goto underlying_strftime
;
666 #if defined _NL_CURRENT || !HAVE_STRFTIME
667 cpy (wkday_len
, f_wkday
);
670 goto underlying_strftime
;
674 case 'h': /* POSIX.2 extension. */
677 #if defined _NL_CURRENT || !HAVE_STRFTIME
678 cpy (am_len
, a_month
);
681 goto underlying_strftime
;
692 #if defined _NL_CURRENT || !HAVE_STRFTIME
693 cpy (month_len
, f_month
);
696 goto underlying_strftime
;
703 if (! (modifier
== 'E'
704 && *(subfmt
= _NL_CURRENT (LC_TIME
, ERA_D_T_FMT
)) != '\0'))
705 subfmt
= _NL_CURRENT (LC_TIME
, D_T_FMT
);
708 goto underlying_strftime
;
710 subfmt
= "%a %b %e %H:%M:%S %Y";
717 size_t len
= my_strftime (NULL
, maxsize
- i
, subfmt
, tp
);
718 if (len
== 0 && *subfmt
)
720 add (len
, my_strftime (p
, maxsize
- i
, subfmt
, tp
));
723 while (old_start
< p
)
725 *old_start
= TOUPPER ((unsigned char) *old_start
);
731 #if HAVE_STRFTIME && ! (defined _NL_CURRENT && HAVE_STRUCT_ERA_ENTRY)
734 /* The relevant information is available only via the
735 underlying strftime implementation, so use that. */
738 char ubuf
[1024]; /* enough for any single format in practice */
745 len
= strftime (ubuf
, sizeof ubuf
, ufmt
, tp
);
753 case 'C': /* POSIX.2 extension. */
758 #if HAVE_STRUCT_ERA_ENTRY
759 struct era_entry
*era
= _nl_get_era_entry (tp
);
762 size_t len
= strlen (era
->name_fmt
);
763 cpy (len
, era
->name_fmt
);
768 goto underlying_strftime
;
774 int year
= tp
->tm_year
+ TM_YEAR_BASE
;
775 DO_NUMBER (1, year
/ 100 - (year
% 100 < 0));
782 if (! (modifier
== 'E'
783 && *(subfmt
= _NL_CURRENT (LC_TIME
, ERA_D_FMT
)) != '\0'))
784 subfmt
= _NL_CURRENT (LC_TIME
, D_FMT
);
788 goto underlying_strftime
;
793 case 'D': /* POSIX.2 extension. */
803 DO_NUMBER (2, tp
->tm_mday
);
805 case 'e': /* POSIX.2 extension. */
809 DO_NUMBER_SPACEPAD (2, tp
->tm_mday
);
811 /* All numeric formats set DIGITS and NUMBER_VALUE and then
812 jump to one of these two labels. */
815 /* Force `_' flag unless overwritten by `0' flag. */
820 /* Format the number according to the MODIFIER flag. */
822 if (modifier
== 'O' && 0 <= number_value
)
825 /* Get the locale specific alternate representation of
826 the number NUMBER_VALUE. If none exist NULL is returned. */
827 const char *cp
= _nl_get_alt_digit (number_value
);
831 size_t digitlen
= strlen (cp
);
840 goto underlying_strftime
;
845 unsigned int u
= number_value
;
847 bufp
= buf
+ sizeof (buf
);
848 negative_number
= number_value
< 0;
854 *--bufp
= u
% 10 + '0';
855 while ((u
/= 10) != 0);
858 do_number_sign_and_padding
:
864 int padding
= digits
- (buf
+ sizeof (buf
) - bufp
);
868 while (0 < padding
--)
873 bufp
+= negative_number
;
874 while (0 < padding
--)
881 cpy (buf
+ sizeof (buf
) - bufp
, bufp
);
894 DO_NUMBER (2, tp
->tm_hour
);
900 DO_NUMBER (2, hour12
);
902 case 'k': /* GNU extension. */
906 DO_NUMBER_SPACEPAD (2, tp
->tm_hour
);
908 case 'l': /* GNU extension. */
912 DO_NUMBER_SPACEPAD (2, hour12
);
918 DO_NUMBER (3, 1 + tp
->tm_yday
);
924 DO_NUMBER (2, tp
->tm_min
);
930 DO_NUMBER (2, tp
->tm_mon
+ 1);
932 case 'n': /* POSIX.2 extension. */
938 #if !defined _NL_CURRENT && HAVE_STRFTIME
949 #if defined _NL_CURRENT || !HAVE_STRFTIME
953 goto underlying_strftime
;
956 case 'R': /* GNU extension. */
960 case 'r': /* POSIX.2 extension. */
962 if (*(subfmt
= _NL_CURRENT (LC_TIME
, T_FMT_AMPM
)) == '\0')
964 subfmt
= "%I:%M:%S %p";
971 DO_NUMBER (2, tp
->tm_sec
);
973 case 's': /* GNU extension. */
981 /* Generate string value for T using time_t arithmetic;
982 this works even if sizeof (long) < sizeof (time_t). */
984 bufp
= buf
+ sizeof (buf
);
985 negative_number
= t
< 0;
996 /* Adjust if division truncates to minus infinity. */
997 if (0 < -1 % 10 && d
< 0)
1009 goto do_number_sign_and_padding
;
1013 if (modifier
== 'O')
1016 if (! (modifier
== 'E'
1017 && *(subfmt
= _NL_CURRENT (LC_TIME
, ERA_T_FMT
)) != '\0'))
1018 subfmt
= _NL_CURRENT (LC_TIME
, T_FMT
);
1022 goto underlying_strftime
;
1027 case 'T': /* POSIX.2 extension. */
1028 subfmt
= "%H:%M:%S";
1031 case 't': /* POSIX.2 extension. */
1036 case 'u': /* POSIX.2 extension. */
1037 DO_NUMBER (1, (tp
->tm_wday
- 1 + 7) % 7 + 1);
1040 if (modifier
== 'E')
1043 DO_NUMBER (2, (tp
->tm_yday
- tp
->tm_wday
+ 7) / 7);
1046 case 'g': /* GNU extension. */
1047 case 'G': /* GNU extension. */
1048 if (modifier
== 'E')
1051 int year
= tp
->tm_year
+ TM_YEAR_BASE
;
1052 int days
= iso_week_days (tp
->tm_yday
, tp
->tm_wday
);
1056 /* This ISO week belongs to the previous year. */
1058 days
= iso_week_days (tp
->tm_yday
+ (365 + __isleap (year
)),
1063 int d
= iso_week_days (tp
->tm_yday
- (365 + __isleap (year
)),
1067 /* This ISO week belongs to the next year. */
1076 DO_NUMBER (2, (year
% 100 + 100) % 100);
1079 DO_NUMBER (1, year
);
1082 DO_NUMBER (2, days
/ 7 + 1);
1087 if (modifier
== 'E')
1090 DO_NUMBER (2, (tp
->tm_yday
- (tp
->tm_wday
- 1 + 7) % 7 + 7) / 7);
1093 if (modifier
== 'E')
1096 DO_NUMBER (1, tp
->tm_wday
);
1099 if (modifier
== 'E')
1101 #if HAVE_STRUCT_ERA_ENTRY
1102 struct era_entry
*era
= _nl_get_era_entry (tp
);
1105 subfmt
= strchr (era
->name_fmt
, '\0') + 1;
1110 goto underlying_strftime
;
1114 if (modifier
== 'O')
1117 DO_NUMBER (1, tp
->tm_year
+ TM_YEAR_BASE
);
1120 if (modifier
== 'E')
1122 #if HAVE_STRUCT_ERA_ENTRY
1123 struct era_entry
*era
= _nl_get_era_entry (tp
);
1126 int delta
= tp
->tm_year
- era
->start_date
[0];
1127 DO_NUMBER (1, (era
->offset
1128 + (era
->direction
== '-' ? -delta
: delta
)));
1132 goto underlying_strftime
;
1136 DO_NUMBER (2, (tp
->tm_year
% 100 + 100) % 100);
1144 cpy (zonelen
, zone
);
1147 case 'z': /* GNU extension. */
1148 if (tp
->tm_isdst
< 0)
1154 diff
= tp
->tm_gmtoff
;
1163 if (lt
== (time_t) -1)
1165 /* mktime returns -1 for errors, but -1 is also a
1166 valid time_t value. Check whether an error really
1170 if (! localtime_r (<
, &tm
)
1171 || ((ltm
.tm_sec
^ tm
.tm_sec
)
1172 | (ltm
.tm_min
^ tm
.tm_min
)
1173 | (ltm
.tm_hour
^ tm
.tm_hour
)
1174 | (ltm
.tm_mday
^ tm
.tm_mday
)
1175 | (ltm
.tm_mon
^ tm
.tm_mon
)
1176 | (ltm
.tm_year
^ tm
.tm_year
)))
1180 if (! gmtime_r (<
, >m
))
1183 diff
= tm_diff (<m
, >m
);
1195 DO_NUMBER (4, (diff
/ 60) * 100 + diff
% 60);
1198 case '\0': /* GNU extension: % at end of format. */
1202 /* Unknown format; output the format, including the '%',
1203 since this is most likely the right thing to do if a
1204 multibyte string has been misparsed. */
1208 for (flen
= 1; f
[1 - flen
] != '%'; flen
++)
1210 cpy (flen
, &f
[1 - flen
]);