summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixTime.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c
index 1b4ea15..7f22fab 100644
--- a/unix/tclUnixTime.c
+++ b/unix/tclUnixTime.c
@@ -632,6 +632,34 @@ NativeScaleTime(
/*
*----------------------------------------------------------------------
*
+ * TclpScaleUTime --
+ *
+ * This procedure scales number of microseconds if expected.
+ *
+ * Results:
+ * Number of microseconds scaled using tclScaleTimeProcPtr.
+ *
+ *----------------------------------------------------------------------
+ */
+Tcl_WideInt
+TclpScaleUTime(
+ Tcl_WideInt usec)
+{
+ /* Native scale is 1:1. */
+ if (tclScaleTimeProcPtr != NativeScaleTime) {
+ return usec;
+ } else {
+ Tcl_Time scTime;
+ scTime.sec = usec / 1000000;
+ scTime.usec = usec % 1000000;
+ tclScaleTimeProcPtr(&scTime, tclTimeClientData);
+ return ((Tcl_WideInt)scTime.sec) * 1000000 + scTime.usec;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* NativeGetTime --
*
* TIP #233: Gets the current system time in seconds and microseconds