SubTimesLocal
Funkcia %SubTimesLocal
Funkcia
Funkcia odpočíta od absolútneho času TimeA absolútny čas TimeB. Výsledkom je hodnota typu Relatívny čas.
Deklarácia
REAL %SubTimesLocal(
TIME in TimeA,
TIME in TimeB,
TEXT in timeZone := %GetCurrentTimeZone()
)Parametre
TimeA | Absolútny čas. |
TimeB | Absolútny čas. |
timeZone |
Popis
Funkcia %SubTimesLocal odčítava od seba dva absolútne časy. Výsledok nebude ovplyvnený skutočnosťou, či v tomto intervale boli alebo neboli časové prechody. Napríklad rozdiel medzi 4:00 a 1:00 ráno je vždy 3 hodiny.
Príklad
; =================================================================
; Using time zone "Europe/Bratislava"
; Daylight saving time was observed in year 2009, therefore time shifts occured.
; Winter [B] time was 1 hour ahead of UTC, summer [A] time was 2 hours ahead of UTC.
; Summer time was 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
; 2009-10-25 00:30:00 UTC
_timeA := %StrToTimeEx("2009-10-25 A2:30:00", "yyyy-mm-dd hh:mi:ss", "Europe/Bratislava")
; 2009-10-25 01:30:00 UTC
_timeB := %StrToTimeEx("2009-10-25 B2:30:00", "yyyy-mm-dd hh:mi:ss", "Europe/Bratislava")
; 2009-10-24 23:30:00 UTC
_baseTime := %StrToTimeEx("2009-10-25 01:30:00", "yyyy-mm-dd hh:mi:ss", "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")
ENDSúvisiace stránky: