mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug #1030
- Added portable implementation of timegm for non GNU/BSD platforms that don't have their own implementation - Removed the use of tm_gmtoff on non GNU/BSD platforms that don't have it as part of the tm struct in time.h - Added CMake tests HAVE_TIMEGM and HAVE_TM_GMTOFF
This commit is contained in:
parent
7e48eb9ec2
commit
a655be823b
6 changed files with 39 additions and 0 deletions
20
src/util.cpp
20
src/util.cpp
|
@ -610,3 +610,23 @@ const std::string indentProject (
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef HAVE_TIMEGM
|
||||
time_t timegm (struct tm *tm)
|
||||
{
|
||||
time_t ret;
|
||||
char *tz;
|
||||
tz = getenv ("TZ");
|
||||
setenv ("TZ", "UTC", 1);
|
||||
tzset ();
|
||||
ret = mktime (tm);
|
||||
if (tz)
|
||||
setenv ("TZ", tz, 1);
|
||||
else
|
||||
unsetenv ("TZ");
|
||||
tzset ();
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue