public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: timespec_get: implement C11 function
@ 2024-02-16 19:44 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2024-02-16 19:44 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a7bf7c7dd524ab724913da0019f8b4a5425b5927

commit a7bf7c7dd524ab724913da0019f8b4a5425b5927
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Fri Feb 16 20:44:31 2024 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Fri Feb 16 20:44:31 2024 +0100

    Cygwin: timespec_get: implement C11 function
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/cygwin.din            | 1 +
 winsup/cygwin/include/cygwin/time.h | 6 ++++++
 winsup/cygwin/release/3.6.0         | 2 ++
 winsup/cygwin/times.cc              | 9 +++++++++
 4 files changed, 18 insertions(+)

diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din
index be9efdc00f44..37ec00896232 100644
--- a/winsup/cygwin/cygwin.din
+++ b/winsup/cygwin/cygwin.din
@@ -1559,6 +1559,7 @@ timerfd_create SIGFE
 timerfd_gettime SIGFE
 timerfd_settime SIGFE
 times SIGFE
+timespec_get SIGFE
 timezone SIGFE
 timingsafe_bcmp NOSIGFE
 timingsafe_memcmp NOSIGFE
diff --git a/winsup/cygwin/include/cygwin/time.h b/winsup/cygwin/include/cygwin/time.h
index d7f9d3f75b15..9b63e9aeb6ce 100644
--- a/winsup/cygwin/include/cygwin/time.h
+++ b/winsup/cygwin/include/cygwin/time.h
@@ -35,6 +35,12 @@ extern long timezone __asm__ (_SYMSTR (_timezone));
 
 #endif /* __SVID_VISIBLE || __XSI_VISIBLE */
 
+#if __ISO_C_VISIBLE >= 2011
+#define TIME_UTC 1
+
+extern int timespec_get (struct timespec *, int);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/winsup/cygwin/release/3.6.0 b/winsup/cygwin/release/3.6.0
index 561637c397e6..e190aa2927d6 100644
--- a/winsup/cygwin/release/3.6.0
+++ b/winsup/cygwin/release/3.6.0
@@ -7,6 +7,8 @@ What's new:
 
 - New API call: setproctitle.
 
+- New API call: timespec_get.
+
 
 What changed:
 -------------
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index ddea061b8920..87773934bfd7 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -559,3 +559,12 @@ clock_getcpuclockid (pid_t pid, clockid_t *clk_id)
   *clk_id = (clockid_t) PID_TO_CLOCKID (pid);
   return 0;
 }
+
+extern "C" int
+timespec_get (struct timespec *ts, int base)
+{
+  if (base != TIME_UTC)
+    return 0;
+  clock_gettime (CLOCK_REALTIME, ts);
+  return base;
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-16 19:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 19:44 [newlib-cygwin/main] Cygwin: timespec_get: implement C11 function Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).