Revision: 9584 https://osdn.net/projects/ttssh2/scm/svn/commits/9584 Author: zmatsuo Date: 2021-12-07 23:39:20 +0900 (Tue, 07 Dec 2021) Log Message: ----------- バックアップファイルの日時文字列をISO8601基本形式に変更 Modified Paths: -------------- trunk/teraterm/common/ttlib.h trunk/teraterm/common/ttlib_static_cpp.cpp trunk/teraterm/ttpcmn/ttcmn.c -------------- next part -------------- Modified: trunk/teraterm/common/ttlib.h =================================================================== --- trunk/teraterm/common/ttlib.h 2021-12-07 14:39:10 UTC (rev 9583) +++ trunk/teraterm/common/ttlib.h 2021-12-07 14:39:20 UTC (rev 9584) @@ -200,6 +200,7 @@ DWORD TTWinExecA(const char *commandA); void CreateBakupFile(const wchar_t *fname, const wchar_t *prev_str); BOOL ConvertIniFileCharCode(const wchar_t *fname, const wchar_t *bak_str); +wchar_t *MakeISO8601Str(time_t t); #ifdef __cplusplus } Modified: trunk/teraterm/common/ttlib_static_cpp.cpp =================================================================== --- trunk/teraterm/common/ttlib_static_cpp.cpp 2021-12-07 14:39:10 UTC (rev 9583) +++ trunk/teraterm/common/ttlib_static_cpp.cpp 2021-12-07 14:39:20 UTC (rev 9584) @@ -1548,3 +1548,22 @@ return converted; } + +/** + * ISO8601\x8A\xEE\x96{\x8C`\x8E\xAE\x82̓\x{239E576}\x8E\x9A\x97\xF1\x82\xF0\x8D쐬\x82\xB7\x82\xE9 + * + * @param t \x95\xB6\x8E\x9A\x97\xF1\x82\xF0\x8D쐬\x82\xB7\x82鎞\x8A\xD4 + * 0\x82Ō\xBB\x8Dݎ\x9E\x8D\x8F + * @return \x95\xB6\x8E\x9A\x97\xF1\x81A\x95s\x97v\x82ɂȂ\xC1\x82\xBD\x82\xE7free()\x82\xB7\x82邱\x82\xC6 + */ +wchar_t *MakeISO8601Str(time_t t) +{ + if (t == 0) { + t = time(NULL); + } + struct tm now_tm; + localtime_s(&now_tm, &t); + wchar_t date_str[128]; + wcsftime(date_str, _countof(date_str), L"%Y%m%dT%H%M%S%z", &now_tm); + return _wcsdup(date_str); +} Modified: trunk/teraterm/ttpcmn/ttcmn.c =================================================================== --- trunk/teraterm/ttpcmn/ttcmn.c 2021-12-07 14:39:10 UTC (rev 9583) +++ trunk/teraterm/ttpcmn/ttcmn.c 2021-12-07 14:39:20 UTC (rev 9584) @@ -253,15 +253,13 @@ }; // backup \x83t\x83@\x83C\x83\x8B\x82ɂ\xAF\x82\xE9\x93\xFA\x95t\x95\xB6\x8E\x9A\x97\xF1 - time_t now; - time(&now); - struct tm *now_tm; - now_tm = localtime(&now); - wchar_t dete_str[256]; - wcsftime(dete_str, _countof(dete_str), L"%y%m%d_%H%M%S_", now_tm); + wchar_t *date_str = MakeISO8601Str(0); + awcscat(&date_str, L"_"); // ini\x83t\x83@\x83C\x83\x8B\x82\xF0\x95ϊ\xB7\x82\xB7\x82\xE9 - ConvertIniFiles(filelist, ts->HomeDirW, dete_str); + ConvertIniFiles(filelist, ts->HomeDirW, date_str); + + free(date_str); } if (FirstInstance) {