diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-08-10 11:45:58 +0300 |
---|---|---|
committer | Amar Tumballi <amar@kadalu.io> | 2020-08-17 11:27:09 +0000 |
commit | 9978ceb26327de9545c6e0a4f9230b401e629793 (patch) | |
tree | 19468386ccc3f04bfc7a059d6de5710cfd1e88fd /libglusterfs/src/common-utils.c | |
parent | 005d2ac1d8cc57e0e36f7cf230ae09a4f860bd16 (diff) |
libglusterfs: add library wrapper for time()
Add thin convenient library wrapper gf_time(),
adjust related users and comments as well.
Change-Id: If8969af2f45ee69c30c3406bce5baa8305fb7f80
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Updates: #1002
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r-- | libglusterfs/src/common-utils.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index c37c45449f2..bff4c3d633b 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -646,7 +646,7 @@ gf_rev_dns_lookup_cached(const char *ip, struct dnscache *dnscache) if (entrydata) { dnsentry = (struct dnscache_entry *)entrydata->data; /* First check the TTL & timestamp */ - if (time(NULL) - dnsentry->timestamp > dnscache->ttl) { + if (gf_time() - dnsentry->timestamp > dnscache->ttl) { gf_dnscache_entry_deinit(dnsentry); entrydata->data = NULL; /* Mark this as 'null' so * dict_del () doesn't try free @@ -683,7 +683,7 @@ out: if (entry) { entry->fqdn = fqdn; entry->ip = gf_strdup(ip); - entry->timestamp = time(NULL); + entry->timestamp = gf_time(); entrydata = bin_to_data(entry, sizeof(*entry)); dict_set(cache, (char *)ip, entrydata); } @@ -935,7 +935,7 @@ gf_print_trace(int32_t signum, glusterfs_ctx_t *ctx) { /* Dump the timestamp of the crash too, so the previous logs can be related */ - gf_time_fmt(timestr, sizeof timestr, time(NULL), gf_timefmt_FT); + gf_time_fmt(timestr, sizeof timestr, gf_time(), gf_timefmt_FT); gf_msg_plain_nomem(GF_LOG_ALERT, "time of crash: "); gf_msg_plain_nomem(GF_LOG_ALERT, timestr); } |