1 // TortoiseGit - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2008 - TortoiseGit
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "resource.h"
\r
21 #include "TortoiseGitBlameAppUtils.h"
\r
22 #include "Registry.h"
\r
24 CAppUtils::CAppUtils(void)
\r
28 CAppUtils::~CAppUtils(void)
\r
33 * FUNCTION : FormatDateAndTime
\r
34 * DESCRIPTION : Generates a displayable string from a CTime object in
\r
35 * system short or long format dependant on setting of option
\r
36 * as DATE_SHORTDATE or DATE_LONGDATE
\r
37 * If HKCU\Software\TortoiseGit\UseSystemLocaleForDates is 0 then use fixed format
\r
38 * rather than locale
\r
39 * RETURN : CString containing date/time
\r
41 CString CAppUtils::FormatDateAndTime( const CTime& cTime, DWORD option, bool bIncludeTime /*=true*/ )
\r
44 // should we use the locale settings for formatting the date/time?
\r
45 if (CRegDWORD(_T("Software\\TortoiseGit\\UseSystemLocaleForDates"), TRUE))
\r
49 cTime.GetAsSystemTime( sysTime );
\r
53 GetDateFormat(LOCALE_USER_DEFAULT, option, &sysTime, NULL, buf,
\r
54 sizeof(buf)/sizeof(TCHAR)-1);
\r
58 datetime += _T(" ");
\r
59 GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, NULL, buf, sizeof(buf)/sizeof(TCHAR)-1);
\r
65 // no, so fixed format
\r
68 datetime = cTime.Format(_T("%Y-%m-%d %H:%M:%S"));
\r
72 datetime = cTime.Format(_T("%Y-%m-%d"));
\r