Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
v8: use correct timezone information on Solaris
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
hashseed authored and bnoordhuis committed Oct 23, 2012
1 parent 844a005 commit 9fa953d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions deps/v8/src/platform-solaris.cc
Expand Up @@ -125,12 +125,8 @@ const char* OS::LocalTimezone(double time) {


double OS::LocalTimeOffset() {
// On Solaris, struct tm does not contain a tm_gmtoff field.
time_t utc = time(NULL);
ASSERT(utc != -1);
struct tm* loc = localtime(&utc);
ASSERT(loc != NULL);
return static_cast<double>((mktime(loc) - utc) * msPerSecond);
tzset();
return -static_cast<double>(timezone * msPerSecond);
}


Expand Down

0 comments on commit 9fa953d

Please sign in to comment.