diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2014-06-16 12:29:03 -0400 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-11-20 06:59:16 -0800 |
commit | 9797bd197d48ca17a124c245295937ac3d48ab58 (patch) | |
tree | 174fe233d2f1e34e5ce16818e02f68c4f030c4b8 /xlators/protocol/server/src | |
parent | 27c2be4af6f2dc0a18410e17862bb5d3a07231f3 (diff) |
core: use gf_time_fmt() instead of localtime()+strftime()
gf_time_fmt() has existed since 3.3; it provides consistent timestamps
(i.e. UTC times) throughout the implementation. (BTW, the other name for UTC
is GMT.)
N.B. many (all?) commercial storage solutions use UTC time for logging.
This makes for easier debugging across geographically distributed systems.
Also adding a "%s" fmt for portably printing time as simple numeric
value on systems regardless of whether 32-bit or 64-bit time_t. Plus a
minor tweak to return a ptr to the dest-string to allow gf_time_fmt()
to be passed as a param in a *printf().
Someday we should pick the "one true" timestamp format and revise all
calls to gf_time_fmt() to use it instead of the five or six different
formats.
Change-Id: I78202ae14b7246fa424efeea56bf2463e14abfb0
BUG: 1109917
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/8085
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/protocol/server/src')
-rw-r--r-- | xlators/protocol/server/src/server.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index a511540cac6..6f6be52ab15 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -632,6 +632,7 @@ int server_init_grace_timer (xlator_t *this, dict_t *options, server_conf_t *conf) { + char timestr[64] = {0,}; int32_t ret = -1; int32_t grace_timeout = -1; char *lk_heal = NULL; @@ -655,8 +656,10 @@ server_init_grace_timer (xlator_t *this, dict_t *options, else conf->grace_ts.tv_sec = 10; - gf_log (this->name, GF_LOG_DEBUG, "Server grace timeout " - "value = %"GF_PRI_SECOND, conf->grace_ts.tv_sec); + gf_time_fmt (timestr, sizeof timestr, conf->grace_ts.tv_sec, + gf_timefmt_s); + gf_log (this->name, GF_LOG_DEBUG, "Server grace timeout value = %s", + timestr); conf->grace_ts.tv_nsec = 0; |