1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

On Linux, use SVR4's (now POSIX) mktime() instead of BSD's non-standard timelocal().

This commit is contained in:
Lev Kujawski 2021-01-06 12:17:28 -07:00 committed by Jon Trulson
parent 0e282a0ad7
commit 13c173d22c
2 changed files with 12 additions and 12 deletions

View file

@ -286,7 +286,7 @@ paint_month(Calendar *c, Tick key, XRectangle *rect)
tm = *_XLocaltime(&key, localtime_buf); tm = *_XLocaltime(&key, localtime_buf);
tm.tm_mday = 1; tm.tm_mday = 1;
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
tm.tm_isdst = -1; tm.tm_isdst = -1;
day = mktime(&tm); day = mktime(&tm);
#else #else
@ -466,7 +466,7 @@ layout_month(
tm = *_XLocaltime(&date, localtime_buf); tm = *_XLocaltime(&date, localtime_buf);
tm.tm_mday = 1; tm.tm_mday = 1;
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
tm.tm_isdst = -1; tm.tm_isdst = -1;
day = mktime(&tm); day = mktime(&tm);
#else #else
@ -703,7 +703,7 @@ count_month_pages(Calendar *c, Tick start_date, int lines_per_box)
tm = *_XLocaltime(&start_date, localtime_buf); tm = *_XLocaltime(&start_date, localtime_buf);
tm.tm_mday = 1; tm.tm_mday = 1;
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
tm.tm_isdst = -1; tm.tm_isdst = -1;
day = (int)mktime(&tm); day = (int)mktime(&tm);
#else #else

View file

@ -814,7 +814,7 @@ next_ndays(time_t t, int n)
tm.tm_min = 0; tm.tm_min = 0;
tm.tm_hour = 0; tm.tm_hour = 0;
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
next = mktime(&tm); next = mktime(&tm);
#else #else
next = timelocal(&tm); next = timelocal(&tm);
@ -1004,7 +1004,7 @@ prev_nmonth(time_t t, int n)
tm.tm_mon += 12; tm.tm_mon += 12;
tm.tm_year--; tm.tm_year--;
} }
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
tm.tm_isdst = -1; tm.tm_isdst = -1;
return(mktime(&tm)); return(mktime(&tm));
#else #else
@ -1088,7 +1088,7 @@ nextnyear(time_t t, int n)
tm = *_XLocaltime(&t, localtime_buf); tm = *_XLocaltime(&t, localtime_buf);
tm.tm_year += n; tm.tm_year += n;
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
return(mktime(&tm)); return(mktime(&tm));
#else #else
return(timelocal(&tm)); return(timelocal(&tm));
@ -1110,7 +1110,7 @@ prevnyear(time_t t, int n)
tm = *_XLocaltime(&t, localtime_buf); tm = *_XLocaltime(&t, localtime_buf);
tm.tm_year -= n; tm.tm_year -= n;
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
return(mktime(&tm)); return(mktime(&tm));
#else #else
return(timelocal(&tm)); return(timelocal(&tm));
@ -1139,7 +1139,7 @@ prevmonth_exactday(time_t t)
prev = previousmonth(previousmonth(t)); /* hop over the month */ prev = previousmonth(previousmonth(t)); /* hop over the month */
tm = *_XLocaltime(&prev, localtime_buf); tm = *_XLocaltime(&prev, localtime_buf);
tm.tm_mday = day; tm.tm_mday = day;
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
tm.tm_isdst = -1; tm.tm_isdst = -1;
prev =(mktime(&tm)) + sdelta; prev =(mktime(&tm)) + sdelta;
#else #else
@ -1172,7 +1172,7 @@ nextmonth_exactday(time_t t)
next = next_nmonth(t, 2); /* hop over the month */ next = next_nmonth(t, 2); /* hop over the month */
tm = *_XLocaltime(&next, localtime_buf); tm = *_XLocaltime(&next, localtime_buf);
tm.tm_mday = day; tm.tm_mday = day;
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
tm.tm_isdst = -1; tm.tm_isdst = -1;
next = mktime(&tm) + sdelta; next = mktime(&tm) + sdelta;
#else #else
@ -1201,7 +1201,7 @@ previousmonth(time_t t)
tm.tm_mday=1; tm.tm_mday=1;
tm.tm_mon--; tm.tm_mon--;
} }
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
tm.tm_isdst = -1; tm.tm_isdst = -1;
return(mktime(&tm)); return(mktime(&tm));
#else #else
@ -1513,7 +1513,7 @@ nextnmth_exactday(time_t t, int n)
t = next; t = next;
} }
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
tm2.tm_isdst = -1; tm2.tm_isdst = -1;
next = mktime(&tm2); next = mktime(&tm2);
#else #else
@ -1549,7 +1549,7 @@ prevnmth_exactday(time_t t, int n)
t = prev; t = prev;
} }
#ifdef SVR4 #if defined(SVR4) || defined(__linux__)
tm2.tm_isdst = -1; tm2.tm_isdst = -1;
prev = mktime(&tm2); prev = mktime(&tm2);
#else #else