Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

%SubTimesLocal function


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

Declaration


Blok kódu
languageesl
themeConfluence
REAL %SubTimesLocal(
   TIME in TimeA,
   TIME in TimeB,
   INTTEXT  in timeZone :=  %GetTimeZone%GetCurrentTimeZone()
 )


Parameters


TimeAAbsolute time.
TimeBAbsolute time.
timeZone
timeZoneForced time zone to convert to a local time. It is set as a time zone offset from UTC during winter in seconds.

Zahrnúť stránku
timeZone
timeZone


Description
The function %SubTimesLocal deducts one absolute time from other another 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


Blok kódu
languageesl
themeRDark
 ; =================================================================
;  Using time zone "Europe/Bratislava"
;  Slovakia (country for this example)
 ;  Time zone is UTC+1.
 ;  There areDaylight saving time was observed in year 2009, therefore time shifts occured.
;  Winter [B] time was 1 hour ahead of UTC, summer [A] andtime winterwas [B]2 timehours (withahead timeof shifts)UTC.
 ;  Summer time iswas 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
 
  ; UTC2009-10-25 00:30:00 25.10.2009UTC
  _timeA := %StrToTimeEx("2009-10-25 A2:30:00 25.10.2009", "yyyy-mm-dd hh:mi:ss dd-mm-rrrr", "Europe/Bratislava")
  ; UTC2009-10-25 01:30:00 25.10.2009UTC
  _timeB := %StrToTimeEx("2009-10-25 B2:30:00 25.10.2009", "yyyy-mm-dd hh:mi:ss dd-mm-rrrr", "Europe/Bratislava")
  ; UTC2009-10-24 23:30:00 24.10.2009UTC
  _baseTime := %StrToTimeEx("2009-10-25 01:30:00 25.10.2009", "yyyy-mm-dd hh:mi:ss dd-mm-rrrr", "Europe/Bratislava")
 
  ; difference 1 hour(s) (3600 seconds)
  _subLocal1 := %SubTimesLocal(_timeA, _baseTime, "Europe/Bratislava")
  ; difference 1 hour(s) (3600 seconds)
  _subLocal2 := %SubTimesLocal(_timeB, _baseTime, "Europe/Bratislava")
 
 END