src/hotspot/share/runtime/os.cpp
changeset 49042 a04a9bee2431
parent 49034 57d0c33ad636
child 49177 eebf559c9e0d
equal deleted inserted replaced
49041:44122f767467 49042:a04a9bee2431
    91   // Called from init_globals().
    91   // Called from init_globals().
    92   // See Threads::create_vm() in thread.cpp, and init.cpp.
    92   // See Threads::create_vm() in thread.cpp, and init.cpp.
    93   os::init_globals();
    93   os::init_globals();
    94 }
    94 }
    95 
    95 
       
    96 static time_t get_timezone(const struct tm* time_struct) {
       
    97 #if defined(_ALLBSD_SOURCE)
       
    98   return time_struct->tm_gmtoff;
       
    99 #elif defined(_WINDOWS)
       
   100   long zone;
       
   101   _get_timezone(&zone);
       
   102   return static_cast<time_t>(zone);
       
   103 #else
       
   104   return timezone;
       
   105 #endif
       
   106 }
       
   107 
    96 // Fill in buffer with current local time as an ISO-8601 string.
   108 // Fill in buffer with current local time as an ISO-8601 string.
    97 // E.g., yyyy-mm-ddThh:mm:ss-zzzz.
   109 // E.g., yyyy-mm-ddThh:mm:ss-zzzz.
    98 // Returns buffer, or NULL if it failed.
   110 // Returns buffer, or NULL if it failed.
    99 // This would mostly be a call to
   111 // This would mostly be a call to
   100 //     strftime(...., "%Y-%m-%d" "T" "%H:%M:%S" "%z", ....)
   112 //     strftime(...., "%Y-%m-%d" "T" "%H:%M:%S" "%z", ....)
   135     if (localtime_pd(&seconds_since_19700101, &time_struct) == NULL) {
   147     if (localtime_pd(&seconds_since_19700101, &time_struct) == NULL) {
   136       assert(false, "Failed localtime_pd");
   148       assert(false, "Failed localtime_pd");
   137       return NULL;
   149       return NULL;
   138     }
   150     }
   139   }
   151   }
   140 #if defined(_ALLBSD_SOURCE)
   152   const time_t zone = get_timezone(&time_struct);
   141   const time_t zone = (time_t) time_struct.tm_gmtoff;
       
   142 #else
       
   143   const time_t zone = timezone;
       
   144 #endif
       
   145 
   153 
   146   // If daylight savings time is in effect,
   154   // If daylight savings time is in effect,
   147   // we are 1 hour East of our time zone
   155   // we are 1 hour East of our time zone
   148   const time_t seconds_per_minute = 60;
   156   const time_t seconds_per_minute = 60;
   149   const time_t minutes_per_hour = 60;
   157   const time_t minutes_per_hour = 60;