Vidíte historickú verziu tejto stránky. Pozrite si aktuálnu verziu.

Porovnať s aktuálnou verziou Zobraziť históriu stránky

Verzia 1 Aktuálny »

%SubTimesLocal function


Function
The function deducts absolute time TimeB from absolute time TimeA. A result is value of Relative time type.

Declaration
REAL %SubTimesLocal(
   TIME in TimeA,
   TIME in TimeB,
   INT  in timeZone :=  %GetTimeZone()
 )

Parameters
TimeA Absolute time.
TimeB Absolute time.
timeZone Forced time zone to convert to a local time. It is set as a time zone offset from UTC during winter in seconds.

Description
The function %SubTimesLocal deducts one absolute time from other one. The result will not be influenced by the fact if the time offset was or was not in this interval. For example, the difference between 4:00 and 1:00 a.m. is always three hours.
Example
 ; =================================================================
 ;  Slovakia (country for this example)
 ;  Time zone is UTC+1.
 ;  There are summer [A] and winter [B] time (with time shifts).
 ;  Summer time is from 29th March, 2009 to 24th October, 2009.
 ;  A3:00:00 is changed to B2:00:00 on Sunday (25th October, 2009).
 ; =================================================================
 
 BEGIN
 
  TIME _timeA
  TIME _timeB
  TIME _baseTime
 
  REAL _subLocal1
  REAL _subLocal2
 
  ; UTC 00:30:00 25.10.2009
  _timeA := %StrToTimeEx("A2:30:00 25.10.2009", "hh:mi:ss dd-mm-rrrr")
  ; UTC 01:30:00 25.10.2009
  _timeB := %StrToTimeEx("B2:30:00 25.10.2009", "hh:mi:ss dd-mm-rrrr")
  ; UTC 23:30:00 24.10.2009
  _baseTime := %StrToTimeEx("01:30:00 25.10.2009", "hh:mi:ss dd-mm-rrrr")
 
  ; difference 1 hour(s) (3600 seconds)
  _subLocal1 := %SubTimesLocal(_timeA, _baseTime)
  ; difference 1 hour(s) (3600 seconds)
  _subLocal2 := %SubTimesLocal(_timeB, _baseTime)
 
 END

  • Žiadne štítky