comparison lib/strftime.c @ 726:8867c987f8cf

(strftime): Accommodate the broken C compiler that comes with SunOS -- don't initialize aggregates in decls of automatic variables. Reported by Kaveh Ghazi.
author Jim Meyering <jim@meyering.net>
date Thu, 10 Oct 1996 02:56:10 +0000
parents 6813ffe12e6a
children 70c419102365
comparison
equal deleted inserted replaced
725:ea86caa7c2cc 726:8867c987f8cf
656 656
657 DO_NUMBER (2, tp->tm_sec); 657 DO_NUMBER (2, tp->tm_sec);
658 658
659 case 's': /* GNU extension. */ 659 case 's': /* GNU extension. */
660 { 660 {
661 struct tm ltm = *tp; 661 struct tm ltm;
662 time_t t = mktime (&ltm); 662 time_t t;
663
664 ltm = *tp;
665 t = mktime (&ltm);
663 666
664 /* Generate string value for T using time_t arithmetic; 667 /* Generate string value for T using time_t arithmetic;
665 this works even if sizeof (long) < sizeof (time_t). */ 668 this works even if sizeof (long) < sizeof (time_t). */
666 669
667 bufp = buf + sizeof (buf); 670 bufp = buf + sizeof (buf);
801 int diff; 804 int diff;
802 #if HAVE_TM_GMTOFF 805 #if HAVE_TM_GMTOFF
803 diff = tp->tm_gmtoff; 806 diff = tp->tm_gmtoff;
804 #else 807 #else
805 struct tm gtm; 808 struct tm gtm;
806 struct tm ltm = *tp; 809 struct tm ltm;
807 time_t lt = mktime (&ltm); 810 time_t lt;
811
812 ltm = *tp;
813 lt = mktime (&ltm);
808 814
809 if (lt == (time_t) -1) 815 if (lt == (time_t) -1)
810 { 816 {
811 /* mktime returns -1 for errors, but -1 is also a 817 /* mktime returns -1 for errors, but -1 is also a
812 valid time_t value. Check whether an error really 818 valid time_t value. Check whether an error really