hotspot/src/share/vm/runtime/os.cpp
changeset 31335 60081f497e75
parent 31026 b87ccf34b54c
child 31347 0fec61c9d330
equal deleted inserted replaced
31334:d55c96b36b5f 31335:60081f497e75
   841   st->print(" %s", VM_Version::cpu_features());
   841   st->print(" %s", VM_Version::cpu_features());
   842   st->cr();
   842   st->cr();
   843   pd_print_cpu_info(st);
   843   pd_print_cpu_info(st);
   844 }
   844 }
   845 
   845 
   846 void os::print_date_and_time(outputStream *st) {
   846 void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
   847   const int secs_per_day  = 86400;
   847   const int secs_per_day  = 86400;
   848   const int secs_per_hour = 3600;
   848   const int secs_per_hour = 3600;
   849   const int secs_per_min  = 60;
   849   const int secs_per_min  = 60;
   850 
   850 
   851   time_t tloc;
   851   time_t tloc;
   852   (void)time(&tloc);
   852   (void)time(&tloc);
   853   st->print("time: %s", ctime(&tloc));  // ctime adds newline.
   853   st->print("time: %s", ctime(&tloc));  // ctime adds newline.
       
   854 
       
   855   struct tm tz;
       
   856   if (localtime_pd(&tloc, &tz) != NULL) {
       
   857     ::strftime(buf, buflen, "%Z", &tz);
       
   858     st->print_cr("timezone: %s", buf);
       
   859   }
   854 
   860 
   855   double t = os::elapsedTime();
   861   double t = os::elapsedTime();
   856   // NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
   862   // NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
   857   //       Linux. Must be a bug in glibc ? Workaround is to round "t" to int
   863   //       Linux. Must be a bug in glibc ? Workaround is to round "t" to int
   858   //       before printf. We lost some precision, but who cares?
   864   //       before printf. We lost some precision, but who cares?