Commit c35070b622324f7b218c970c01ecfac1ee125c29
- Diff rendering mode:
- inline
- side by side
tests/testrunner.cpp
(16 / 0)
|   | |||
| 31 | 31 | #include <cstdio> | |
| 32 | 32 | #include <cstring> | |
| 33 | 33 | ||
| 34 | #include "core/datetools.h" | ||
| 35 | |||
| 34 | 36 | namespace dss { | |
| 35 | 37 | ||
| 36 | 38 | static void _init(void) __attribute__ ((constructor)); | |
| … | … | ||
| 40 | 40 | printf("Testing...\n"); | |
| 41 | 41 | // make sure timezone gets set | |
| 42 | 42 | tzset(); | |
| 43 | |||
| 44 | long int time_offset = timezone; | ||
| 45 | #if defined(__linux__) | ||
| 46 | time_t now; | ||
| 47 | struct tm t; | ||
| 48 | time(&now); | ||
| 49 | localtime_r(&now, &t); | ||
| 50 | mktime(&t); | ||
| 51 | // gmtoff is east of UTC, however timezone is west of UTC | ||
| 52 | time_offset = t.tm_gmtoff * (-1); | ||
| 53 | #endif | ||
| 54 | |||
| 55 | dss::DateTime::configureUTCOffset(time_offset); | ||
| 56 | |||
| 43 | 57 | ||
| 44 | 58 | char* tzNameCopy = strdup("GMT"); | |
| 45 | 59 | tzname[0] = tzname[1] = tzNameCopy; |

