mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
v8: use correct timezone information on Solaris
`timezone` variable contains the difference, in seconds, between UTC and local standard time (see `man 3 localtime` on Solaris). Call to `tzset` is required to apply contents of `TZ` variable to `timezone` variable. BUG=v8:2064 Review URL: https://chromiumcodereview.appspot.com/10967066 Patch from Maciej Małecki <me@mmalecki.com>. This is a back-port of upstream commit r12802.
This commit is contained in:
1 parent
844a0058d0
commit
9fa953d3e7
1 file changed
+2
-6
Vendored
+2
-6
@@ -125,12 +125,8 @@ const char* OS::LocalTimezone(double time) {
|
|||||||
|
|
||||||
|
|
||||||
double OS::LocalTimeOffset() {
|
double OS::LocalTimeOffset() {
|
||||||
// On Solaris, struct tm does not contain a tm_gmtoff field.
|
tzset();
|
||||||
time_t utc = time(NULL);
|
return -static_cast<double>(timezone * msPerSecond);
|
||||||
ASSERT(utc != -1);
|
|
||||||
struct tm* loc = localtime(&utc);
|
|
||||||
ASSERT(loc != NULL);
|
|
||||||
return static_cast<double>((mktime(loc) - utc) * msPerSecond);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user