< prev index next >
src/share/vm/runtime/os.cpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -845,19 +845,25 @@
st->print(" %s", VM_Version::cpu_features());
st->cr();
pd_print_cpu_info(st);
}
-void os::print_date_and_time(outputStream *st) {
+void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
const int secs_per_day = 86400;
const int secs_per_hour = 3600;
const int secs_per_min = 60;
time_t tloc;
(void)time(&tloc);
st->print("time: %s", ctime(&tloc)); // ctime adds newline.
+ struct tm tz;
+ if (localtime_pd(&tloc, &tz) != NULL) {
+ ::strftime(buf, buflen, "%Z", &tz);
+ st->print_cr("timezone: %s", buf);
+ }
+
double t = os::elapsedTime();
// NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
// Linux. Must be a bug in glibc ? Workaround is to round "t" to int
// before printf. We lost some precision, but who cares?
int eltime = (int)t; // elapsed time in seconds
< prev index next >