aboutsummaryrefslogtreecommitdiff
path: root/sys/etc/cnvtime.x
diff options
context:
space:
mode:
Diffstat (limited to 'sys/etc/cnvtime.x')
-rw-r--r--sys/etc/cnvtime.x31
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/etc/cnvtime.x b/sys/etc/cnvtime.x
new file mode 100644
index 00000000..372daf03
--- /dev/null
+++ b/sys/etc/cnvtime.x
@@ -0,0 +1,31 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <time.h>
+
+define SZ_WEEKDAY 3
+define SZ_MONTH 3
+
+# CNVTIME -- Convert a time in integer seconds since midnight on Jan 1, 1980
+# into a string, i.e., "Mon 16:30:05 17-Mar-2001". The maximum length of the
+# output string is given by the parameter SZ_TIME in <time.h>.
+
+procedure cnvtime (ltime, outstr, maxch)
+
+long ltime # seconds since 00:00:00 01-Jan-1980
+char outstr[ARB]
+int maxch
+int tm[LEN_TMSTRUCT] # broken down time structure
+string weekday "SunMonTueWedThuFriSat"
+string month "JanFebMarAprMayJunJulAugSepOctNovDec"
+
+begin
+ call brktime (ltime, tm)
+ call sprintf (outstr, maxch, "%3.3s %02d:%02d:%02d %02d-%3.3s-%04d")
+ call pargstr (weekday [(TM_WDAY(tm) - 1) * SZ_WEEKDAY + 1])
+ call pargi (TM_HOUR(tm))
+ call pargi (TM_MIN(tm))
+ call pargi (TM_SEC(tm))
+ call pargi (TM_MDAY(tm))
+ call pargstr (month [(TM_MONTH(tm) - 1) * SZ_MONTH + 1])
+ call pargi (TM_YEAR(tm))
+end