diff show_time_as_float.c @ 93:8fcf31272f6e draft

planemo upload commit a43893724cc769bed8a1f19a5b19ec1ba20cb63c
author rhpvorderman
date Mon, 06 Mar 2023 11:36:32 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/show_time_as_float.c	Mon Mar 06 11:36:32 2023 +0000
@@ -0,0 +1,16 @@
+/* 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;
+}