Commit d3e70ab4 authored by Claes Sjofors's avatar Claes Sjofors

Time formats for time in filenames

parent bc280088
......@@ -541,10 +541,16 @@ time_AtoAscii (
return TIME__RANGE;
sprintf(tmpStr, ".%02d", (int)(tp->tv_nsec / 10000000));
buflen = strlen(buf);
if (strlen(tmpStr) + buflen < (unsigned int) bufsize)
strcpy(&buf[buflen], tmpStr);
switch (format) {
case time_eFormat_FileDateAndTime:
case time_eFormat_FileDate:
break;
default:
sprintf(tmpStr, ".%02d", (int)(tp->tv_nsec / 10000000));
if (strlen(tmpStr) + buflen < (unsigned int) bufsize)
strcpy(&buf[buflen], tmpStr);
}
return TIME__SUCCESS;
}
......@@ -678,6 +684,10 @@ time_TmToAscii (
strftime(buf, bufsize, "%d-%b-%Y %H:%M:%S", tmptr);
for (i = 3; i < 6; i++)
buf[i] = toupper(buf[i]);
} else if (format == time_eFormat_FileDateAndTime) {
strftime(buf, bufsize, "%Y%m%d_%H%M%S", tmptr);
} else if (format == time_eFormat_FileDate) {
strftime(buf, bufsize, "%Y%m%d", tmptr);
} else if (format == time_eFormat_ComprDateAndTime) {
strftime(buf, bufsize, "%y-%m-%d %H:%M:%S", tmptr);
} else if (format == time_eFormat_NumDateAndTime) {
......
......@@ -87,7 +87,9 @@ typedef enum {
time_eFormat_DateAndTime = 0, //!< Display date and time, 01-JAN-1970 01:00:00.00
time_eFormat_Time = 1, //!< Display time only 01:00:00.00
time_eFormat_ComprDateAndTime = 2, //!< Date and time compressed format, 70-01-01 00:00:00
time_eFormat_NumDateAndTime = 3 //!< Date and time format, 2005-01-01 00:00:00
time_eFormat_NumDateAndTime = 3, //!< Date and time format, 2005-01-01 00:00:00
time_eFormat_FileDateAndTime = 4, //!< Date and time format, 20050101_000000
time_eFormat_FileDate = 5 //!< Date format, 20050101
} time_eFormat;
typedef enum {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment