Bugfix: Use gettimeofday instead of time. It provides higher precision.
Otherwise, we sometimes have a wrong date/time.
This commit is contained in:
parent
5e276db583
commit
53bf8bcb01
@ -344,7 +344,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
struct tm tm;
|
||||
while (1) {
|
||||
time_t current_time = time(NULL);
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
time_t current_time = tv.tv_sec;
|
||||
struct tm *current_tm = NULL;
|
||||
if (current_time != (time_t) -1) {
|
||||
localtime_r(¤t_time, &tm);
|
||||
|
Loading…
Reference in New Issue
Block a user