File tree Expand file tree Collapse file tree 4 files changed +25
-1
lines changed
Expand file tree Collapse file tree 4 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ set (PACKAGE_VERSION "${VERSION}")
2222set (PACKAGE_STRING "${PACKAGE} ${VERSION} " )
2323
2424check_function_exists(strlcpy HAVE_STRLCPY)
25+ check_function_exists(timegm HAVE_TIMEGM)
2526
2627message ("-- Configuring cmake.h" )
2728configure_file (
Original file line number Diff line number Diff line change 3333/* Found strlcpy() */
3434#cmakedefine HAVE_STRLCPY
3535
36+ /* Found timegm(struct tm*) */
37+ #cmakedefine HAVE_TIMEGM
38+
3639/* Functions */
3740#cmakedefine HAVE_GET_CURRENT_DIR_NAME
38- #cmakedefine HAVE_TIMEGM
3941#cmakedefine HAVE_UUID_UNPARSE_LOWER
4042
Original file line number Diff line number Diff line change @@ -3119,6 +3119,23 @@ bool Datetime::validate ()
31193119 return true ;
31203120}
31213121
3122+ #ifndef HAVE_TIMEGM
3123+ time_t Datetime::timegm (struct tm * tm) {
3124+ time_t ret;
3125+ char * tz;
3126+ tz = getenv (" TZ" );
3127+ setenv (" TZ" , " UTC" , 1 );
3128+ tzset ();
3129+ ret = mktime (tm);
3130+ if (tz)
3131+ setenv (" TZ" , tz, 1 );
3132+ else
3133+ unsetenv (" TZ" );
3134+ tzset ();
3135+ return ret;
3136+ }
3137+ #endif
3138+
31223139// //////////////////////////////////////////////////////////////////////////////
31233140// int tm_sec; seconds (0 - 60)
31243141// int tm_min; minutes (0 - 59)
Original file line number Diff line number Diff line change @@ -201,6 +201,10 @@ class Datetime
201201 bool validate ();
202202 void resolve ();
203203
204+ #ifndef HAVE_TIMEGM
205+ time_t timegm (struct tm *);
206+ #endif
207+
204208public:
205209 int _year {0 };
206210 int _month {0 };
You can’t perform that action at this time.
0 commit comments