Implement getTimezoneOffset for Win32 (#291)
Retrieves the current time zone settings with GetTimeZoneInformation to calculate time zone offset
This commit is contained in:
parent
708dbcbf5b
commit
d11f5f600d
1 changed files with 6 additions and 2 deletions
|
@ -32,6 +32,9 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#if !defined(_MSC_VER)
|
#if !defined(_MSC_VER)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <timezoneapi.h>
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
|
@ -40827,8 +40830,9 @@ static const JSCFunctionListEntry js_math_obj[] = {
|
||||||
between UTC time and local time 'd' in minutes */
|
between UTC time and local time 'd' in minutes */
|
||||||
static int getTimezoneOffset(int64_t time) {
|
static int getTimezoneOffset(int64_t time) {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
/* XXX: TODO */
|
TIME_ZONE_INFORMATION time_zone_info;
|
||||||
return 0;
|
GetTimeZoneInformation(&time_zone_info);
|
||||||
|
return (int)time_zone_info.Bias / 60;
|
||||||
#else
|
#else
|
||||||
time_t ti;
|
time_t ti;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
|
Loading…
Reference in a new issue