summaryrefslogtreecommitdiff
path: root/Source/WTF/wtf/GregorianDateTime.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WTF/wtf/GregorianDateTime.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WTF/wtf/GregorianDateTime.cpp')
-rw-r--r--Source/WTF/wtf/GregorianDateTime.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/Source/WTF/wtf/GregorianDateTime.cpp b/Source/WTF/wtf/GregorianDateTime.cpp
index 5560984e6..d6317b308 100644
--- a/Source/WTF/wtf/GregorianDateTime.cpp
+++ b/Source/WTF/wtf/GregorianDateTime.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
+ * Copyright (C) 2012, 2014 Patrick Gansterer <paroga@paroga.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,13 +43,16 @@ void GregorianDateTime::setToCurrentLocalTime()
TIME_ZONE_INFORMATION timeZoneInformation;
DWORD timeZoneId = GetTimeZoneInformation(&timeZoneInformation);
- LONG bias = timeZoneInformation.Bias;
- if (timeZoneId == TIME_ZONE_ID_DAYLIGHT)
- bias += timeZoneInformation.DaylightBias;
- else if (timeZoneId == TIME_ZONE_ID_STANDARD)
- bias += timeZoneInformation.StandardBias;
- else
- ASSERT(timeZoneId == TIME_ZONE_ID_UNKNOWN);
+ LONG bias = 0;
+ if (timeZoneId != TIME_ZONE_ID_INVALID) {
+ bias = timeZoneInformation.Bias;
+ if (timeZoneId == TIME_ZONE_ID_DAYLIGHT)
+ bias += timeZoneInformation.DaylightBias;
+ else if ((timeZoneId == TIME_ZONE_ID_STANDARD) || (timeZoneId == TIME_ZONE_ID_UNKNOWN))
+ bias += timeZoneInformation.StandardBias;
+ else
+ ASSERT(0);
+ }
m_year = systemTime.wYear;
m_month = systemTime.wMonth - 1;
@@ -64,7 +67,11 @@ void GregorianDateTime::setToCurrentLocalTime()
#else
tm localTM;
time_t localTime = time(0);
+#if HAVE(LOCALTIME_R)
localtime_r(&localTime, &localTM);
+#else
+ localtime_s(&localTime, &localTM);
+#endif
m_year = localTM.tm_year + 1900;
m_month = localTM.tm_mon;