For local timestamps (character) in the format "yyyy-mm-dd HH:MM:SS"
,
of which is known that they are recorded in time zone Europe/Berlin, i.e. CET
in winter and CEST in summer, the UTC offset (i.e. "+1"
in winter
and "+2"
in summer) is determined. Therefore, it is required that
the timestamps
are ordered by time, which should be the case if they
were recorded by a measuring device. Use this function to create unique
timestamps by adding their UTC offset.
utcOffsetBerlinTime(timestamps)
timestamps | vector of character representing timestamps in format
|
---|
vector of elements "+0100"
or "+0200"
, depending on
whether the timestamps at corresponding positions in timestamps
are
in CET or CEST, respectively.
# Change from CET to CEST utcOffsetBerlinTime(c( "2017-03-26 01:58:00", "2017-03-26 01:59:00", "2017-03-26 03:00:00", # jump from 02:00 to 03:00 "2017-03-26 03:01:00", "2017-03-26 03:02:00" ))#> [1] 1 1 2 2 2#> "+0200" "+0200" "+0100" "+0100" "+0100" # Note that the following timestamps do not exist in Europe/Berlin timezone # and would result in an error if (FALSE) { utcOffsetBerlinTime(c( "2017-03-26 02:00:00", "2017-03-26 02:15:00", "2017-03-26 02:30:00", "2017-03-26 02:45:00" ))} #> "+0200" "+0200" "+0200" "+0200" # Change from CEST to CET utcOffsetBerlinTime(c( "2017-10-29 01:30:00", # CEST "2017-10-29 02:00:00", # first time: CEST "2017-10-29 02:30:00", # first time: CEST "2017-10-29 02:00:00", # second time: CET "2017-10-29 02:30:00" # second time: CET ))#> [1] 2 2 2 1 1#> "+0200" "+0200" "+0200" "+0100" "+0100"