OSDN Git Service

Change timestamp in backup file name to YYYYmmddHHMMSS style
authorsdottaka <none@none>
Sun, 27 Jun 2010 03:32:29 +0000 (12:32 +0900)
committersdottaka <none@none>
Sun, 27 Jun 2010 03:32:29 +0000 (12:32 +0900)
Src/MainFrm.cpp

index aafee88..8a16dcb 100644 (file)
@@ -1460,10 +1460,12 @@ BOOL CMainFrame::CreateBackup(BOOL bFolder, LPCTSTR pszPath)
                // nice way to add a real time (invalid chars etc).
                if (GetOptionsMgr()->GetBool(OPT_BACKUP_ADD_TIME))
                {
+                       struct tm *tm;
                        time_t curtime = 0;
                        time(&curtime);
+                       tm = localtime(&curtime);
                        CString timestr;
-                       timestr.Format(_T("%d"), curtime);
+                       timestr.Format(_T("%04d%02d%02d%02d%02d%02d"), tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
                        filename += _T("-");
                        filename += timestr;
                }