CodeSnip Old Code (SVN)
A repository for source code snippets, designed with Pascal in mind.
Brought to you by:
delphidabbler
--- a/trunk/Src/UUpdateCheckers.pas +++ b/trunk/Src/UUpdateCheckers.pas @@ -149,8 +149,6 @@ /// <exceptions>If S is not a valid config file date a fatal exception will /// be raised.</exceptions> function ParseDate(const S: string): TDateTime; - /// <summary>Returns the current date and time as GMT/UTC.</summary> - function NowAsGMT: TDateTime; public /// <summary>Construct new object instance and reads last update check /// times from storage.</summary> @@ -175,7 +173,7 @@ Classes, Windows, DateUtils, // Project FmUpdateDlg, UAppInfo, UPreferences, UProgramUpdateChecker, USettings, - UStrUtils, UUpdateMgr; + UStrUtils, UUpdateMgr, UUtils; { TProgramUpdateCheckerThread } @@ -326,7 +324,7 @@ function TUpdateCheckerConfig.CanCheck(Kind: TCheckKind): Boolean; begin - Result := DaysBetween(NowAsGMT, fLastUpdateCheck[Kind]) > 0; + Result := DaysBetween(NowGMT, fLastUpdateCheck[Kind]) > 0; end; constructor TUpdateCheckerConfig.Create; @@ -363,14 +361,6 @@ begin // In config file we store date in SQL date format Result := FormatDateTime('yyyy"-"mm"-"dd" "hh":"nn":"ss', DT); -end; - -function TUpdateCheckerConfig.NowAsGMT: TDateTime; -var - ST: TSystemTime; -begin - GetSystemTime(ST); - Result := SystemTimeToDateTime(ST); end; function TUpdateCheckerConfig.ParseDate(const S: string): TDateTime; @@ -391,7 +381,7 @@ procedure TUpdateCheckerConfig.RecordCheck(Kind: TCheckKind); begin - fLastUpdateCheck[Kind] := NowAsGMT; + fLastUpdateCheck[Kind] := NowGMT; end; function TUpdateCheckerConfig.ValueName(const Kind: TCheckKind): string;