view show_time_as_float.c @ 94:84e9e5c8c101 draft

"planemo upload commit d4be85014b638f1d50b318d4b735be7f6e973140"
author rhpvorderman
date Fri, 24 Mar 2023 16:58:28 +0000
parents 8fcf31272f6e
children
line wrap: on
line source

/* script adapted from https://www.nu42.com/2021/07/windows-c-time-in-nanoseconds.html */
#include <stdio.h>
#include <time.h>

int main(void)
{
    struct timespec ts;

    if (timespec_get(&ts, TIME_UTC) != TIME_UTC)
    {
        fputs("timespec_get failed!", stderr);
        return 1;
    }
    printf("%ld.%ld\n", ts.tv_sec, ts.tv_nsec);
    return 0;
}