MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / current_time

Function current_time

common/perf_counter.cpp:41–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41static uint64_t current_time(char cur[], int length)
42{
43 struct timeval t;
44 gettimeofday(&t, nullptr);
45 struct tm tim;
46 ::localtime_r(&t.tv_sec, &tim);
47 snprintf(cur, length, "%04d-%02d-%02d %02d:%02d:%02d",
48 ((unsigned int)tim.tm_year + 1900) % 10000,
49 ((unsigned int)tim.tm_mon + 1) % 100,
50 (unsigned int)tim.tm_mday % 100,
51 (unsigned int)tim.tm_hour % 100,
52 (unsigned int)tim.tm_min % 100,
53 (unsigned int)tim.tm_sec % 100);
54 return ((uint64_t)t.tv_sec*1000 + t.tv_usec/1000);
55}
56
57static void log_perf_counters()
58{

Callers 1

log_perf_countersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected