Commit c35070b622324f7b218c970c01ecfac1ee125c29

  • avatar
  • Sergey 'Jin' Bostandzhyan <jin @deve…per.digitalstrom.org>
  • Sun Aug 08 16:44:42 CEST 2010
Localtime adjustments for tests
tests/testrunner.cpp
(16 / 0)
  
3131#include <cstdio>
3232#include <cstring>
3333
34#include "core/datetools.h"
35
3436namespace dss {
3537
3638 static void _init(void) __attribute__ ((constructor));
4040 printf("Testing...\n");
4141 // make sure timezone gets set
4242 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
4357
4458 char* tzNameCopy = strdup("GMT");
4559 tzname[0] = tzname[1] = tzNameCopy;