From 9c930092a4ff41cc5775e165cffcd42cee2b6c30 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 26 Jun 2017 11:52:07 -0700 Subject: [PATCH] SCP: Add insertion symbol UTIME for Unix time (seconds since 1/1/1970) --- README.md | 1 + scp.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 33aa1716..256c29ab 100644 --- a/README.md +++ b/README.md @@ -332,6 +332,7 @@ Built In variables %DATE%, %TIME%, %DATETIME%, %LDATE%, %LTIME%, %CTIME%, %DATE_ %LDATE% mm/dd/yy (Locale Formatted) %LTIME% hh:mm:ss am/pm (Locale Formatted) %CTIME% Www Mmm dd hh:mm:ss yyyy (Locale Formatted) + %UTIME% nnnn (Unix time - seconds since 1/1/1970) %DATE_YYYY% yyyy (0000-9999) %DATE_YY% yy (00-99) %DATE_MM% mm (01-12) diff --git a/scp.c b/scp.c index 78f120a6..df44788e 100644 --- a/scp.c +++ b/scp.c @@ -1373,6 +1373,7 @@ static const char simh_help[] = "++%%LDATE%% mm/dd/yy (Locale Formatted)\n" "++%%LTIME%% hh:mm:ss am/pm (Locale Formatted)\n" "++%%CTIME%% Www Mmm dd hh:mm:ss yyyy (Locale Formatted)\n" + "++%%UTIME%% nnnn (Unix time - seconds since 1/1/1970)\n" "++%%DATE_YYYY%% yyyy (0000-9999)\n" "++%%DATE_YY%% yy (00-99)\n" "++%%DATE_MM%% mm (01-12)\n" @@ -3191,8 +3192,10 @@ return stat | SCPE_NOMESSAGE; /* suppress message sinc variables: %DATE% yyyy-mm-dd %TIME% hh:mm:ss + %DATETIME% yyyy-mm-ddThh:mm:ss %STIME% hh_mm_ss %CTIME% Www Mmm dd hh:mm:ss yyyy + %UTIME% nnn (Unix time - seconds since 1/1/1970) %STATUS% Status value from the last command executed %TSTATUS% The text form of the last status value %SIM_VERIFY% The Verify/Verbose mode of the current Do command file @@ -3292,7 +3295,7 @@ for (; *ip && (op < oend); ) { ap = rbuf; } /* Locale oriented formatted date/time info */ - if (!strcmp ("LDATE", gbuf)) { + else if (!strcmp ("LDATE", gbuf)) { strftime (rbuf, sizeof(rbuf), "%x", tmnow); ap = rbuf; } @@ -3317,6 +3320,10 @@ for (; *ip && (op < oend); ) { #endif ap = rbuf; } + else if (!strcmp ("UTIME", gbuf)) { + sprintf (rbuf, "%" LL_FMT "d", (LL_TYPE)now); + ap = rbuf; + } /* Separate Date/Time info */ else if (!strcmp ("DATE_YYYY", gbuf)) {/* Year (0000-9999) */ strftime (rbuf, sizeof(rbuf), "%Y", tmnow);