summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-20 14:41:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-20 14:41:18 +0000
commit34d205b40b9adab0f10ad62bf08e6999fe339348 (patch)
tree08c035d6ac90e3e78a1e4411bdfe414b88a65f5d
parent04f4e2acfbc82946ca3def654214c08071a87359 (diff)
MS_DB_TIME_* removed from pascal headers too
git-svn-id: http://svn.miranda-ng.org/main/trunk@14289 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/delphi/m_database.inc48
-rw-r--r--include/delphi/m_timezones.inc9
-rw-r--r--plugins/HistoryPlusPlus/hpp_events.pas3
-rw-r--r--plugins/ImportTXT/BqhfIP.inc2
-rw-r--r--plugins/ImportTXT/General.pas6
-rw-r--r--plugins/ImportTXT/ImportTU.pas4
-rw-r--r--plugins/QuickSearch/i_ok.inc6
7 files changed, 15 insertions, 63 deletions
diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc
index 8036b42a7d..24eedfa197 100644
--- a/include/delphi/m_database.inc
+++ b/include/delphi/m_database.inc
@@ -516,54 +516,6 @@ const
MS_DB_EVENT_GETSTRINGT:PAnsiChar = 'DB/Event/GetStringT';
-//**************************** Time ********************************
-
- {
- wParam : timestamp (dword)
- lParam : 0
- Affect : Converts a GMT timestap into local time
- Returns: Returns the converted value, see notes
- Notes : Timestamps have a zereo at midnight 1/1/1970 GMT, this service
- converts such a value to be based at midnight 1/1/1970 local time.
- This service does not use a simple conversion based on the current offset
- between GMT and local. Rather, it figures out whether daylight savings time
- would have been in place at the time of the stamp and gives the local time as
- it would have been at the time and date the stamp contains.
- }
- MS_DB_TIME_TIMESTAMPTOLOCAL:PAnsiChar = 'DB/Time/TimestampToLocal';
-
- {
- wParam : timestamp (dword)
- lParam : pointer to initalised DBTIMETOSTRING structure
- Affect : Converts a GMT timestamp to a customisable local time string
- see notes
- Returns: Always returns 0
- notes : The string is formatted according to thhe current user's locale
- language and preference.
-
- szFormat can have the following special chars :
- t time without seconds, e.g. hh:mm
- s time with seconds, e.g. hh:mm:ss
- m time without minutes e.g. hh
- d short date, e.g. dd/mm/yyyy
- D long date, e.g. d mmmm yyyy
- I ISO 8061 Time yyyy-mm-ddThh:mm:ssZ
-
- all other characters are copied as is.
- }
-
-type
- PDBTIMETOSTRING = ^TDBTIMETOSTRING;
- TDBTIMETOSTRING = record
- szFormat: TChar; // format string, see above
- szDest : TChar; // pointer to dest buffer to store the result
- cbDest : int; // size of the buffer
- end;
-
-const
- MS_DB_TIME_TIMESTAMPTOSTRING :PAnsiChar = 'DB/Time/TimestampToString';
- MS_DB_TIME_TIMESTAMPTOSTRINGT:PAnsiChar = 'DB/Time/TimestampToStringT';
-
//*************************** Random *******************************
{
diff --git a/include/delphi/m_timezones.inc b/include/delphi/m_timezones.inc
index 95e99f7413..3dfb75c66b 100644
--- a/include/delphi/m_timezones.inc
+++ b/include/delphi/m_timezones.inc
@@ -38,4 +38,13 @@ const
type
mir_time = int_ptr;
+function TimeZone_ToLocal(timestamp:DWORD) : DWORD; stdcall;
+ external CoreDll name 'TimeZone_ToLocal';
+
+function TimeZone_ToString(timeVal:mir_time; const szFormat:PAnsiChar; szDest:PAnsiChar; cchDest:size_t) : mir_time; stdcall;
+ external CoreDll name 'TimeZone_ToString';
+
+function TimeZone_ToStringW(timeVal:mir_time; const szFormat:PWideChar; szDest:PWideChar; cchDest:size_t) : mir_time; stdcall;
+ external CoreDll name 'TimeZone_ToStringW';
+
{$ENDIF}
diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas
index 401822797d..848008a37e 100644
--- a/plugins/HistoryPlusPlus/hpp_events.pas
+++ b/plugins/HistoryPlusPlus/hpp_events.pas
@@ -236,8 +236,7 @@ const
// Miranda timestamp to TDateTime
function TimestampToDateTime(const Timestamp: DWord): TDateTime;
begin
- Result := UnixTimeStart +
- CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,WPARAM(Timestamp),0) / SecondsPerDay;
+ Result := UnixTimeStart + TimeZone_ToLocal(Timestamp) / SecondsPerDay;
end;
// should probably add function param to use
diff --git a/plugins/ImportTXT/BqhfIP.inc b/plugins/ImportTXT/BqhfIP.inc
index 91160dd1cc..aa7a9a8758 100644
--- a/plugins/ImportTXT/BqhfIP.inc
+++ b/plugins/ImportTXT/BqhfIP.inc
@@ -96,7 +96,7 @@ begin
dbei.szModule := PAnsiChar(proto);
dbei.timestamp := RLInteger(pt + i + $12);
dbei.timestamp := dbei.timestamp -
- (Cardinal(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, dbei.timestamp, 0)) - dbei.timestamp); // приводим к GMT
+ (Cardinal(TimeZone_ToLocal(dbei.timestamp)) - dbei.timestamp); // приводим к GMT
if PByte(pt + i + $1A)^ = $00 then
dbei.flags := DBEF_READ or DBEF_UTF
else
diff --git a/plugins/ImportTXT/General.pas b/plugins/ImportTXT/General.pas
index e6bac9318b..3fedce5df0 100644
--- a/plugins/ImportTXT/General.pas
+++ b/plugins/ImportTXT/General.pas
@@ -476,14 +476,10 @@ end;
function TimeStampToWStr(ts: DWORD): WideString;
var
- dbtts: TDBTIMETOSTRING;
s: WideString;
begin
SetLength(s, 20);
- dbtts.szFormat.w := 'd s';
- dbtts.szDest.w := PWideChar(s);
- dbtts.cbDest := 20;
- CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, ts, int(@dbtts));
+ TimeZone_ToStringW(ts, 'd s', PWideChar(s), 20);
result := s;
end;
diff --git a/plugins/ImportTXT/ImportTU.pas b/plugins/ImportTXT/ImportTU.pas
index b81a21167d..2fac66ad55 100644
--- a/plugins/ImportTXT/ImportTU.pas
+++ b/plugins/ImportTXT/ImportTU.pas
@@ -60,7 +60,7 @@ begin
DT := (D * 24 * 60 * 60) + (Hour * 3600 + Min * 60 + Sec);
// Приводим к GMT...судя по всему миранда хранит таймштампы в GMT
if toGMT then
- Result := DT - (Longword(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, DT, 0)) - DT)
+ Result := DT - (Longword(TimeZone_ToLocal(DT)) - DT)
else
Result := DT;
end;
@@ -69,7 +69,7 @@ function DateTimeToTimeStamp(const DateTime: TDateTime; toGMT: Boolean = true):
begin
Result := Round((DateTime - UnixDateDelta) * SecsPerDay);
if toGMT then
- Result := Result - (Dword(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL, Result, 0)) - Result);
+ Result := Result - (Dword(TimeZone_ToLocal(Result)) - Result);
end;
function ChangeUnicode(str: PWideChar): PWideChar;
diff --git a/plugins/QuickSearch/i_ok.inc b/plugins/QuickSearch/i_ok.inc
index 7ac8db8f70..51e756aacd 100644
--- a/plugins/QuickSearch/i_ok.inc
+++ b/plugins/QuickSearch/i_ok.inc
@@ -172,12 +172,8 @@ end;
function TimeToStrW(data:dword):PWideChar;
var
strdatetime:array [0..63] of WideChar;
- dbtts:TDBTIMETOSTRING;
begin
- dbtts.cbDest :=Length(strdatetime);
- dbtts.szDest.w :=@strdatetime;
- dbtts.szFormat.w:='d - t';
- CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT,data,lparam(@dbtts));
+ TimeZone_ToStringW(data, 'd - t', @strdatetime, Length(strdatetime));
StrDupW(result,strdatetime);
end;