share relative time-string resources
[TortoiseGit.git] / src / TortoiseGitBlame / TortoiseGitBlameAppUtils.h
blob2a5d429fedf41f15934e9720a6e47eadd9d29151
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
20 /**
21 * \ingroup TortoiseGitBlame
22 * An utility class with static functions.
24 class CAppUtils
26 public:
27 CAppUtils(void);
28 ~CAppUtils(void);
30 /**
31 * FUNCTION : FormatDateAndTime
32 * DESCRIPTION : Generates a displayable string from a CTime object in
33 * system short or long format or as a relative value
34 * cTime - the time
35 * option - DATE_SHORTDATE or DATE_LONGDATE
36 * bIncluedeTime - whether to show time as well as date
37 * bRelative - if true then relative time is shown if reasonable
38 * If HKCU\Software\TortoiseGit\UseSystemLocaleForDates is 0 then use fixed format
39 * rather than locale
40 * RETURN : CString containing date/time
42 static CString FormatDateAndTime( const CTime& cTime, DWORD option, bool bIncludeTime=true,
43 bool bRelative=false );
44 /**
45 * Converts a given time to a relative display string (relative to current time)
46 * Given time must be in local timezone
48 static CString ToRelativeTimeString(CTime time);
50 private:
51 /**
52 * Generates a display string showing the relative time between the two given times as COleDateTimes
54 static CString ToRelativeTimeString(COleDateTime time,COleDateTime RelativeTo);
55 static CString ExpandRelativeTime( int count, UINT format_1, UINT format_n );