summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/misc.cpp17
-rw-r--r--src/common/misc.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/common/misc.cpp b/src/common/misc.cpp
index b96abca..65689e6 100644
--- a/src/common/misc.cpp
+++ b/src/common/misc.cpp
@@ -230,6 +230,23 @@ void TimeToAscii(time_t time, char *buffer)
#endif*/
}
+// Converting time to string.
+
+void TimeToAsciiClean(time_t time, char *buffer)
+{
+ struct tm when;
+ int year;
+
+ when = *localtime(&time);
+ year = when.tm_year+1900;
+ if ( year < 2000 ) year -= 1900;
+ else year -= 2000;
+
+ sprintf(buffer, "%.2d%.2d%.2d%.2d%.2d",
+ year, when.tm_mon+1, when.tm_mday,
+ when.tm_hour, when.tm_min);
+}
+
// Copy a list of numbered files into the temporary folder.
bool CopyFileListToTemp(char* filename, int* list, int total)
diff --git a/src/common/misc.h b/src/common/misc.h
index bcebf76..3c147b1 100644
--- a/src/common/misc.h
+++ b/src/common/misc.h
@@ -28,6 +28,7 @@ extern char GetToUpper(char letter);
extern char GetToLower(char letter);
extern void TimeToAscii(time_t time, char *buffer);
+extern void TimeToAsciiClean(time_t time, char *buffer);
extern bool CopyFileListToTemp(char* filename, int* list, int total);
extern void AddExt(char* filename, const char* ext);