From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/etc/cnvtime.x | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sys/etc/cnvtime.x (limited to 'sys/etc/cnvtime.x') 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 + +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 . + +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 -- cgit