summaryrefslogtreecommitdiff
path: root/lib/gettime.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gettime.c')
-rw-r--r--lib/gettime.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/gettime.c b/lib/gettime.c
index fff502bd19c..38d36859415 100644
--- a/lib/gettime.c
+++ b/lib/gettime.c
@@ -1,7 +1,6 @@
/* gettime -- get the system clock
- Copyright (C) 2002, 2004-2007, 2009-2024 Free Software Foundation,
- Inc.
+ Copyright (C) 2002, 2004-2007, 2009-2024 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -36,8 +35,8 @@ gettime (struct timespec *ts)
#else
struct timeval tv;
gettimeofday (&tv, NULL);
- ts->tv_sec = tv.tv_sec;
- ts->tv_nsec = tv.tv_usec * 1000;
+ *ts = (struct timespec) { .tv_sec = tv.tv_sec,
+ .tv_nsec = tv.tv_usec * 1000 };
#endif
}