From dbf7b13e9fe5c02c1bbe1c3345120cd746831498 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 10 Aug 2001 00:46:15 +0000 Subject: [PATCH] added some strftime tests --- src/libCom/test/epicsTimeTest.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/libCom/test/epicsTimeTest.cpp b/src/libCom/test/epicsTimeTest.cpp index d4992a6c6..6727e70d7 100644 --- a/src/libCom/test/epicsTimeTest.cpp +++ b/src/libCom/test/epicsTimeTest.cpp @@ -12,6 +12,31 @@ int epicsTimeTest (void); epicsTime useSomeCPU; +void testStringConversion() +{ + char buf[64]; + epicsTime uninit; + + const char * pFormat = "%a %b %d %Y %H:%M:%S.%f"; + uninit.strftime ( buf, sizeof ( buf ), pFormat ); + printf ("Uninitialized using \"%s\" %s\n", pFormat, buf ); + + epicsTime current = epicsTime::getCurrent(); + + pFormat = "%a %b %d %Y %H:%M:%S.%f"; + current.strftime ( buf, sizeof ( buf ), pFormat ); + printf ("using \"%s\" %s\n", pFormat, buf ); + + pFormat = "%a %b %d %Y %H:%M:%S.%4f"; + current.strftime ( buf, sizeof ( buf ), pFormat ); + printf ("using \"%s\" %s\n", pFormat, buf ); + + pFormat = "%a %b %d %Y %H:%M:%S.%05f"; + current.strftime ( buf, sizeof ( buf ), pFormat ); + printf ("using \"%s\" %s\n", pFormat, buf ); + +} + int epicsTimeTest (void) { unsigned i, errors, sum_errors=0, sum_errloops=0;