Module interpret_time

Function Index

byxxx_match/2 determine if CurrentDateTime is part of any of the intervals specified by the time-switch.
create_startpoints/3 get the starting points in the range specified by Start according to Freq and interval in time-switch Note : invalid dates may be created as well as date-time values beyond "until" - this should not be a problem as valid_range/3 in check_intervals/3 will handle the invalid dates and as "dtstart" =< current time =< "until" is check previously in_time_range/4 there should be no chance for date-times beyond "until" to match.
create_startpoints/4 create all the time (starting) points defined by ByxxxVals - ByType associated with the time Start.
get_bysetpos/2 get all start points specified by "bysetpos" in certain freq reoccurrence, specified by Time.
get_count_ranges_5/2 get all ranges specified by the "count" attribute in a "time-switch".
get_count_ranges_7/2 get all ranges specified by the "count" attribute in a "time-switch".
get_count_ranges_8/2 get all ranges specified by the "count" attribute in a "time-switch".
get_level_params/2 get the {Level, Val} entries from ByParam (the N first elements), also return the remaining lower level elements Note : Level must be the highest level in ByParams.
get_lowest_level/2
get_next_level/3 get the next supplied level and it's ByParams where Level =< NextLevel Note : CurrentLevel must be > bysecond.
get_next_process_level/3
get_set/2 get the freq reoccurrence set of start points, this is achived by jumping into the middle of generate_counts/7 based on freq (supplied by TimeSwitchCond), DT determines which freq reoccurrence that is examined.
get_start_level/2
in_time_range/2 determine if the time period specified by the TimeSwitchCond is currently occurring Note : local_usec() uses calendar:local_time(), which relies on the OS to return a proper DateTime with correct DST.
in_time_range/3
in_time_range_5/3 determine if current time Current, falls inside a time period specified by TimeSwitchCond.
in_time_range_test/3
in_usec_range/3 determine if Start =< Current =< End Start, End and Current are retrieved with local_usec/0 or datetime_to_usec/2 (these functions MUST be used).
is_bysetpos_usable/1
is_current_time_valid_bysetpos/2 determine if Current is a time that is part of the [StartPoint, StartPoint + Duration] range where StartPoint is a start point selected by the "bysetpos" parameter (there may be several start points to check).
is_reoccurrence/2
is_start_time_valid_bysetpos/2 takes a start time generated by "count" preprocessing and determines if such a date-time is also a valid occurrence of bysetpos.
level_type/1
local_usec/0 convert local (current) time to a universal format (gregorian seconds in UTC format) Note : local time reported is based on what the OS supplies / is set to.
match_param/4
nth/2 get elemenet N in list L.
safe_local_time_to_universal_time_dst/1 see calendar:local_time_to_universal_time_dst(DateTime) A patch to handle a bug when a illegal date occurs when changing to DST (daylight saving time) i.e.
sort_byparam/1 sort list of byxxx parameters in order as specified by RFC 3880 chapter 4.4 page 18.

Function Details

byxxx_match/2

byxxx_match(TimeSwitchCond, CurrentDateTime) -> true | false

determine if CurrentDateTime is part of any of the intervals specified by the time-switch

create_startpoints/3

create_startpoints(Start, X2::Freq, TimeSwitchCond) -> [#date_time{}]

get the starting points in the range specified by Start according to Freq and interval in time-switch Note : invalid dates may be created as well as date-time values beyond "until" - this should not be a problem as valid_range/3 in check_intervals/3 will handle the invalid dates and as "dtstart" =< current time =< "until" is check previously in_time_range/4 there should be no chance for date-times beyond "until" to match

create_startpoints/4

create_startpoints(Start, ByxxxVals, X3::ByType, Wkst) -> [#date_time{}]

create all the time (starting) points defined by ByxxxVals - ByType associated with the time Start

get_bysetpos/2

get_bysetpos(TimeSwitchCond, Time) -> [#date_time{}]

get all start points specified by "bysetpos" in certain freq reoccurrence, specified by Time

get_count_ranges_5/2

get_count_ranges_5(Timezone, TimeSwitchCond) -> [{Start, Stop}]

get all ranges specified by the "count" attribute in a "time-switch"

get_count_ranges_7/2

get_count_ranges_7(Timezone, TimeSwitchCond) -> [{Start, Stop}]

get all ranges specified by the "count" attribute in a "time-switch"

get_count_ranges_8/2

get_count_ranges_8(Timezone, TimeSwitchCond) -> [{Start, Stop}]

get all ranges specified by the "count" attribute in a "time-switch"

get_level_params/2

get_level_params(Level, ByParams) -> {LevelParams, LowerLevelParams}

get the {Level, Val} entries from ByParam (the N first elements), also return the remaining lower level elements Note : Level must be the highest level in ByParams

get_lowest_level/2

get_lowest_level() -> term()

get_next_level/3

get_next_level(CurrentLevel, ByParams, TimeSwitchCond) -> {NextLevel, NextProcessLevel, NextLevelByParams}

get the next supplied level and it's ByParams where Level =< NextLevel Note : CurrentLevel must be > bysecond

get_next_process_level/3

get_next_process_level() -> term()

get_set/2

get_set(DT, TimeSwitchCond) -> [#date_time{}]

get the freq reoccurrence set of start points, this is achived by jumping into the middle of generate_counts/7 based on freq (supplied by TimeSwitchCond), DT determines which freq reoccurrence that is examined. Note : this function is somewhat ugly, as it may skips several levels in generate_counts(...) to get the proper branch and by accessing the start point accumulation (ets) table directly, all which requires extra setup and clean up Note :

get_start_level/2

get_start_level() -> term()

in_time_range/2

in_time_range(Timezone, TimeSwitchCond) -> true | false

determine if the time period specified by the TimeSwitchCond is currently occurring Note : local_usec() uses calendar:local_time(), which relies on the OS to return a proper DateTime with correct DST

in_time_range/3

in_time_range() -> term()

in_time_range_5/3

in_time_range_5(Current, Timezone, TimeSwitchCond) -> true | false

determine if current time Current, falls inside a time period specified by TimeSwitchCond

in_time_range_test/3

in_time_range_test() -> term()

in_usec_range/3

in_usec_range(Start, End, Current) -> true | false

determine if Start =< Current =< End Start, End and Current are retrieved with local_usec/0 or datetime_to_usec/2 (these functions MUST be used)

is_bysetpos_usable/1

is_bysetpos_usable() -> term()

is_current_time_valid_bysetpos/2

is_current_time_valid_bysetpos(TimeSwitchCond, Current) -> true | false

determine if Current is a time that is part of the [StartPoint, StartPoint + Duration] range where StartPoint is a start point selected by the "bysetpos" parameter (there may be several start points to check). Note : Current is used to determine which (freq) reoccurrence should be used to create the start point set, from which bysetpos selects start points

is_reoccurrence/2

is_reoccurrence() -> term()

is_start_time_valid_bysetpos/2

is_start_time_valid_bysetpos(TimeSwitchCond, StartTime) -> true | false

takes a start time generated by "count" preprocessing and determines if such a date-time is also a valid occurrence of bysetpos. This will only work properly if both "count" handling and is_start_time_valid_bysetpos/2 use the same TimeSwitchCond. Note : Current is used to determine which (freq) reoccurrence should be used to create the start point set, from which bysetpos selects start points Note : the handling of bysetpos for "count" preprocessing is currently O(N*S), N = number of counts, S = size of bysetpos set (=< 366)

level_type/1

level_type() -> term()

local_usec/0

local_usec() -> integer()

returns: gregorian seconds in UTC format

convert local (current) time to a universal format (gregorian seconds in UTC format) Note : local time reported is based on what the OS supplies / is set to

match_param/4

match_param() -> term()

nth/2

nth(L, N) -> term() | '#not_found'

returns: '#not_found' if N refers to position beyond the elements in L

get elemenet N in list L. N = 1 is the index of the first element, N = 2 the second and so on. Negative indexes are count from the end rather than the front of L.

safe_local_time_to_universal_time_dst/1

safe_local_time_to_universal_time_dst(LDateTime::DateTime) -> term()

returns: as calendar:local_time_to_universal_time_dst(DateTime)

see calendar:local_time_to_universal_time_dst(DateTime) A patch to handle a bug when a illegal date occurs when changing to DST (daylight saving time) i.e. when the clock is moved forward a hour during spring. Setup: MacOSX 10.3.6 / Erlang/OTP R10B-1 Error:

   >
           catch
           calendar:local_time_to_universal_time_dst({{2004,3,28},{2,0,1}}).
           {'EXIT',{badarg,[{erlang,universaltime_to_localtime,
           [{{1969,12,31},{23,59,59}}]},
           {calendar,local_time_to_universal_time_dst,1},
           {erl_eval,do_apply,5}, {erl_eval,expr,5},
           {shell,exprs,6}, {shell,eval_loop,3}]}}

sort_byparam/1

sort_byparam(ByParams) -> [term()]

returns: byxxx elements

sort list of byxxx parameters in order as specified by RFC 3880 chapter 4.4 page 18


Generated by EDoc, Oct 17 2007, 16:48:06.