logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 7b1db006810ec2183efe9c360fe9bf4e14adede9
parent 39c01fc1a04816c3774289865b455a4f21131e22
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 10 Feb 2025 21:03:11 +0100

cmd/date: get nanoseconds via timespec_get

Diffstat:

Mcmd/date.c3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/cmd/date.c b/cmd/date.c @@ -59,8 +59,7 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); errno = 0; - tp.tv_sec = time(NULL); - if(tp.tv_sec == (time_t)-1) + if(timespec_get(&tp, TIME_UTC) != TIME_UTC) { fprintf(stderr, "%s: error: Failed getting current time: %s\n", argv0, strerror(errno)); return 1;