summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2013-12-27 22:28:25 +0100
committerkrzys-h <krzys_h@interia.pl>2013-12-27 22:28:25 +0100
commit0ff7e55b3343fbca959fb11236a009fb3790b652 (patch)
tree196b9cec76ac2dea901c680af10bc306841f6b1f /src/common
parent1b7389367897b858781790f2ada63203b4035ada (diff)
downloadcolobot-0ff7e55b3343fbca959fb11236a009fb3790b652.tar.gz
colobot-0ff7e55b3343fbca959fb11236a009fb3790b652.tar.bz2
colobot-0ff7e55b3343fbca959fb11236a009fb3790b652.zip
Fix for #177 - save list sorting
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);