skoehler Respected Contributor.
Respected Contributor.
774 views

IDM 4.7.1: Calculation error for token-convert-time offset

Hi, this drove me crazy when testing stuff. It did work for a while, suddenly my Validator tests fail. Ripped out my hairs until I found this: Is it a bug or NetIQs feature for fools day 1st of April? this can really mess up things.

when testing my policy logic, I found a strange behavior in IDM (4.7.1) and IDM Designer Simulator (4.7.1). My timezone is GMT+1

In my testing, I receive the following results by the rule attached below:

20190328 + 1 days is 20190329
20190328 + 2 days is 20190330
20190328 + 3 days is 20190331
20190328 + 4 days is 20190331 (ups)
20190328 + 5 days is 20190401
20190328 + 6 days is 20190402


Could anybody validate this on his environment?
Thanks
Steffen

<rule>
<description>Test First of April</description>
<conditions>
<and/>
</conditions>
<actions>
<do-set-local-variable name="lv-today" scope="policy">
<arg-string>
<token-text xml:space="preserve">20190328</token-text>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="lv-counter" scope="policy">
<arg-string>
<token-text xml:space="preserve">1</token-text>
</arg-string>
</do-set-local-variable>
<do-while>
<arg-conditions>
<and>
<if-local-variable mode="nocase" name="lv-counter" op="not-equal">7</if-local-variable>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="lv-DayOffset" scope="policy">
<arg-string>
<token-convert-time dest-format="yyyyMMdd" dest-tz="UTC" offset="$lv-counter$" offset-unit="day" src-format="yyyyMMdd" src-tz="UTC">
<token-local-variable name="lv-today"/>
</token-convert-time>
</arg-string>
</do-set-local-variable>
<do-trace-message>
<arg-string>
<token-local-variable name="lv-today"/>
<token-text xml:space="preserve"> + </token-text>
<token-local-variable name="lv-counter"/>
<token-text xml:space="preserve"> days is </token-text>
<token-local-variable name="lv-DayOffset"/>
</arg-string>
</do-trace-message>
<do-set-local-variable name="lv-counter" scope="policy">
<arg-string>
<token-xpath expression="$lv-counter +1"/>
</arg-string>
</do-set-local-variable>
</arg-actions>
</do-while>
</actions>
</rule>
Labels (1)
0 Likes
12 Replies
Knowledge Partner
Knowledge Partner

Re: IDM 4.7.1: Calculation error for token-convert-time offs

skoehler;2494266 wrote:
Hi, this drove me crazy when testing stuff. It did work for a while, suddenly my Validator tests fail. Ripped out my hairs until I found this: Is it a bug or NetIQs feature for fools day 1st of April? this can really mess up things.

when testing my policy logic, I found a strange behavior in IDM (4.7.1) and IDM Designer Simulator (4.7.1). My timezone is GMT+1

In my testing, I receive the following results by the rule attached below:

20190328 + 1 days is 20190329
20190328 + 2 days is 20190330
20190328 + 3 days is 20190331
20190328 + 4 days is 20190331 (ups)
20190328 + 5 days is 20190401
20190328 + 6 days is 20190402


Could anybody validate this on his environment?
Thanks
Steffen

<rule>
<description>Test First of April</description>
<conditions>
<and/>
</conditions>
<actions>
<do-set-local-variable name="lv-today" scope="policy">
<arg-string>
<token-text xml:space="preserve">20190328</token-text>
</arg-string>
</do-set-local-variable>
<do-set-local-variable name="lv-counter" scope="policy">
<arg-string>
<token-text xml:space="preserve">1</token-text>
</arg-string>
</do-set-local-variable>
<do-while>
<arg-conditions>
<and>
<if-local-variable mode="nocase" name="lv-counter" op="not-equal">7</if-local-variable>
</and>
</arg-conditions>
<arg-actions>
<do-set-local-variable name="lv-DayOffset" scope="policy">
<arg-string>
<token-convert-time dest-format="yyyyMMdd" dest-tz="UTC" offset="$lv-counter$" offset-unit="day" src-format="yyyyMMdd" src-tz="UTC">
<token-local-variable name="lv-today"/>
</token-convert-time>
</arg-string>
</do-set-local-variable>
<do-trace-message>
<arg-string>
<token-local-variable name="lv-today"/>
<token-text xml:space="preserve"> + </token-text>
<token-local-variable name="lv-counter"/>
<token-text xml:space="preserve"> days is </token-text>
<token-local-variable name="lv-DayOffset"/>
</arg-string>
</do-trace-message>
<do-set-local-variable name="lv-counter" scope="policy">
<arg-string>
<token-xpath expression="$lv-counter +1"/>
</arg-string>
</do-set-local-variable>
</arg-actions>
</do-while>
</actions>
</rule>


IMHO, bug.

Works correctly here in Designer 4.6.2 simulator.


Generic Null : Evaluating selection criteria for rule 'Test First of April'.
Generic Null : Rule selected.
Generic Null : Applying rule 'Test First of April'.
Generic Null : Action: do-set-local-variable("lv-today",scope="policy","20190328").
Generic Null : arg-string("20190328")
Generic Null : token-text("20190328")
Generic Null : Arg Value: "20190328".
Generic Null : Action: do-set-local-variable("lv-counter",scope="policy","1").
Generic Null : arg-string("1")
Generic Null : token-text("1")
Generic Null : Arg Value: "1".
Generic Null : Action: do-while().
Generic Null : Evaluating conditions.
Generic Null : (if-local-variable 'lv-counter' not-equal "7") = TRUE.
Generic Null : Performing while actions.
Generic Null : Action: do-set-local-variable("lv-DayOffset",scope="policy",token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))).
Generic Null : arg-string(token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today")))
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : Expanded variable reference '$lv-counter$' to '1'.
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : Arg Value: "20190328".
Generic Null : Token Value: "20190329".
Generic Null : Arg Value: "20190329".
Generic Null : Action: do-trace-message(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset")).
Generic Null : arg-string(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : token-text(" + ")
Generic Null : token-local-variable("lv-counter")
Generic Null : Token Value: "1".
Generic Null : token-text(" days is ")
Generic Null : token-local-variable("lv-DayOffset")
Generic Null : Token Value: "20190329".
Generic Null : Arg Value: "20190328 + 1 days is 20190329".
Generic Null :20190328 + 1 days is 20190329
Generic Null : Action: do-set-local-variable("lv-counter",scope="policy",token-xpath("$lv-counter +1")).
Generic Null : arg-string(token-xpath("$lv-counter +1"))
Generic Null : token-xpath("$lv-counter +1")
Generic Null : Token Value: "2".
Generic Null : Arg Value: "2".
Generic Null : Evaluating conditions.
Generic Null : (if-local-variable 'lv-counter' not-equal "7") = TRUE.
Generic Null : Performing while actions.
Generic Null : Action: do-set-local-variable("lv-DayOffset",scope="policy",token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))).
Generic Null : arg-string(token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today")))
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : Expanded variable reference '$lv-counter$' to '2'.
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : Arg Value: "20190328".
Generic Null : Token Value: "20190330".
Generic Null : Arg Value: "20190330".
Generic Null : Action: do-trace-message(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset")).
Generic Null : arg-string(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : token-text(" + ")
Generic Null : token-local-variable("lv-counter")
Generic Null : Token Value: "2".
Generic Null : token-text(" days is ")
Generic Null : token-local-variable("lv-DayOffset")
Generic Null : Token Value: "20190330".
Generic Null : Arg Value: "20190328 + 2 days is 20190330".
Generic Null :20190328 + 2 days is 20190330
Generic Null : Action: do-set-local-variable("lv-counter",scope="policy",token-xpath("$lv-counter +1")).
Generic Null : arg-string(token-xpath("$lv-counter +1"))
Generic Null : token-xpath("$lv-counter +1")
Generic Null : Token Value: "3".
Generic Null : Arg Value: "3".
Generic Null : Evaluating conditions.
Generic Null : (if-local-variable 'lv-counter' not-equal "7") = TRUE.
Generic Null : Performing while actions.
Generic Null : Action: do-set-local-variable("lv-DayOffset",scope="policy",token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))).
Generic Null : arg-string(token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today")))
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : Expanded variable reference '$lv-counter$' to '3'.
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : Arg Value: "20190328".
Generic Null : Token Value: "20190331".
Generic Null : Arg Value: "20190331".
Generic Null : Action: do-trace-message(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset")).
Generic Null : arg-string(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : token-text(" + ")
Generic Null : token-local-variable("lv-counter")
Generic Null : Token Value: "3".
Generic Null : token-text(" days is ")
Generic Null : token-local-variable("lv-DayOffset")
Generic Null : Token Value: "20190331".
Generic Null : Arg Value: "20190328 + 3 days is 20190331".
Generic Null :20190328 + 3 days is 20190331
Generic Null : Action: do-set-local-variable("lv-counter",scope="policy",token-xpath("$lv-counter +1")).
Generic Null : arg-string(token-xpath("$lv-counter +1"))
Generic Null : token-xpath("$lv-counter +1")
Generic Null : Token Value: "4".
Generic Null : Arg Value: "4".
Generic Null : Evaluating conditions.
Generic Null : (if-local-variable 'lv-counter' not-equal "7") = TRUE.
Generic Null : Performing while actions.
Generic Null : Action: do-set-local-variable("lv-DayOffset",scope="policy",token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))).
Generic Null : arg-string(token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today")))
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : Expanded variable reference '$lv-counter$' to '4'.
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : Arg Value: "20190328".
Generic Null : Token Value: "20190401".
Generic Null : Arg Value: "20190401".
Generic Null : Action: do-trace-message(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset")).
Generic Null : arg-string(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : token-text(" + ")
Generic Null : token-local-variable("lv-counter")
Generic Null : Token Value: "4".
Generic Null : token-text(" days is ")
Generic Null : token-local-variable("lv-DayOffset")
Generic Null : Token Value: "20190401".
Generic Null : Arg Value: "20190328 + 4 days is 20190401".
Generic Null :20190328 + 4 days is 20190401
Generic Null : Action: do-set-local-variable("lv-counter",scope="policy",token-xpath("$lv-counter +1")).
Generic Null : arg-string(token-xpath("$lv-counter +1"))
Generic Null : token-xpath("$lv-counter +1")
Generic Null : Token Value: "5".
Generic Null : Arg Value: "5".
Generic Null : Evaluating conditions.
Generic Null : (if-local-variable 'lv-counter' not-equal "7") = TRUE.
Generic Null : Performing while actions.
Generic Null : Action: do-set-local-variable("lv-DayOffset",scope="policy",token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))).
Generic Null : arg-string(token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today")))
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : Expanded variable reference '$lv-counter$' to '5'.
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : Arg Value: "20190328".
Generic Null : Token Value: "20190402".
Generic Null : Arg Value: "20190402".
Generic Null : Action: do-trace-message(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset")).
Generic Null : arg-string(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : token-text(" + ")
Generic Null : token-local-variable("lv-counter")
Generic Null : Token Value: "5".
Generic Null : token-text(" days is ")
Generic Null : token-local-variable("lv-DayOffset")
Generic Null : Token Value: "20190402".
Generic Null : Arg Value: "20190328 + 5 days is 20190402".
Generic Null :20190328 + 5 days is 20190402
Generic Null : Action: do-set-local-variable("lv-counter",scope="policy",token-xpath("$lv-counter +1")).
Generic Null : arg-string(token-xpath("$lv-counter +1"))
Generic Null : token-xpath("$lv-counter +1")
Generic Null : Token Value: "6".
Generic Null : Arg Value: "6".
Generic Null : Evaluating conditions.
Generic Null : (if-local-variable 'lv-counter' not-equal "7") = TRUE.
Generic Null : Performing while actions.
Generic Null : Action: do-set-local-variable("lv-DayOffset",scope="policy",token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))).
Generic Null : arg-string(token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today")))
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : Expanded variable reference '$lv-counter$' to '6'.
Generic Null : token-convert-time(dest-format="yyyyMMdd",dest-tz="UTC",offset="$lv-counter$",offset-unit="day",src-format="yyyyMMdd",src-tz="UTC",token-local-variable("lv-today"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : Arg Value: "20190328".
Generic Null : Token Value: "20190403".
Generic Null : Arg Value: "20190403".
Generic Null : Action: do-trace-message(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset")).
Generic Null : arg-string(token-local-variable("lv-today")+" + "+token-local-variable("lv-counter")+" days is "+token-local-variable("lv-DayOffset"))
Generic Null : token-local-variable("lv-today")
Generic Null : Token Value: "20190328".
Generic Null : token-text(" + ")
Generic Null : token-local-variable("lv-counter")
Generic Null : Token Value: "6".
Generic Null : token-text(" days is ")
Generic Null : token-local-variable("lv-DayOffset")
Generic Null : Token Value: "20190403".
Generic Null : Arg Value: "20190328 + 6 days is 20190403".
Generic Null :20190328 + 6 days is 20190403
Generic Null : Action: do-set-local-variable("lv-counter",scope="policy",token-xpath("$lv-counter +1")).
Generic Null : arg-string(token-xpath("$lv-counter +1"))
Generic Null : token-xpath("$lv-counter +1")
Generic Null : Token Value: "7".
Generic Null : Arg Value: "7".
Generic Null : Evaluating conditions.
Generic Null : (if-local-variable 'lv-counter' not-equal "7") = FALSE.
0 Likes
skoehler Respected Contributor.
Respected Contributor.

Re: IDM 4.7.1: Calculation error for token-convert-time offs

Thanks, for me it get's worse testing further dates:

2018: no error
20180328 + 1 days is 20180329
20180328 + 2 days is 20180330
20180328 + 3 days is 20180331
20180328 + 4 days is 20180401
20180328 + 5 days is 20180402
20180328 + 6 days is 20180403

2020:
20200328 + 1 days is 20200329
20200328 + 2 days is 20200329 (ups)
20200328 + 3 days is 20200330
20200328 + 4 days is 20200331
20200328 + 5 days is 20200401
20200328 + 6 days is 20200402
0 Likes
Knowledge Partner
Knowledge Partner

Re: IDM 4.7.1: Calculation error for token-convert-time offs

skoehler;2494272 wrote:
Thanks, for me it get's worse testing further dates:

2018: no error
20180328 + 1 days is 20180329
20180328 + 2 days is 20180330
20180328 + 3 days is 20180331
20180328 + 4 days is 20180401
20180328 + 5 days is 20180402
20180328 + 6 days is 20180403

2020:
20200328 + 1 days is 20200329
20200328 + 2 days is 20200329 (ups)
20200328 + 3 days is 20200330
20200328 + 4 days is 20200331
20200328 + 5 days is 20200401
20200328 + 6 days is 20200402


Hm. Works ok here on Designer 4.7.1 (build id 20180614)

Generic Null :20190328 + 4 days is 20190401
Generic Null :20200328 + 2 days is 20200330
Generic Null :20200328 + 4 days is 20200401
0 Likes
skoehler Respected Contributor.
Respected Contributor.

Re: IDM 4.7.1: Calculation error for token-convert-time offs

Figured it out. It is related to daylight savings time. I changed the token-convert-time to use local timezone instead of UTC and now it works...


AARRRG!
0 Likes
Knowledge Partner
Knowledge Partner

Re: IDM 4.7.1: Calculation error for token-convert-time offset

On 1/24/2019 1:24 PM, skoehler wrote:
>
> Figured it out. It is related to daylight savings time. I changed the
> token-convert-time to use local timezone instead of UTC and now it
> works...


Also watch out where you are near a midnight range in a timezone. Odd
things can happen.

0 Likes
Knowledge Partner
Knowledge Partner

Re: IDM 4.7.1: Calculation error for token-convert-time offs

skoehler;2494278 wrote:
Figured it out. It is related to daylight savings time. I changed the token-convert-time to use local timezone instead of UTC and now it works...


AARRRG!


That's odd. Why would it fail for you, and work for me, if the problem was a DST calculation?
0 Likes
Knowledge Partner
Knowledge Partner

Re: IDM 4.7.1: Calculation error for token-convert-time offset

dgersic <dgersic@no-mx.forums.microfocus.com> wrote:
>

skoehler;2494278 Wrote:
> Figured it out. It is related to daylight savings time. I changed the
> token-convert-time to use local timezone instead of UTC and now it
> works...
>>
>>
>> AARRRG!

>
> That's odd. Why would it fail for you, and work for me, if the problem

was a DST calculation?

Different DST switchover dates in different time zones.

Alex McHugh - Knowledge Partner - Stavanger, Norway
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.
0 Likes
Knowledge Partner
Knowledge Partner

Re: IDM 4.7.1: Calculation error for token-convert-time offs

alexmchugh;2494286 wrote:
dgersic <dgersic@no-mx.forums.microfocus.com> wrote:
>

skoehler;2494278 Wrote:
> Figured it out. It is related to daylight savings time. I changed the
> token-convert-time to use local timezone instead of UTC and now it
> works...
>>
>>
>> AARRRG!

>
> That's odd. Why would it fail for you, and work for me, if the problem

was a DST calculation?

Different DST switchover dates in different time zones.


His rule has the whole thing in UTC, which has no DST.


<token-convert-time dest-format="yyyyMMdd" dest-tz="UTC" offset="$lv-counter$" offset-unit="day" src-format="yyyyMMdd" src-tz="UTC">


He runs the rule, and it generates unexpected results for "4 days after 28 March 2019". I run the rule, and it generates the expected results for the exact same thing.

I'm not seeing how DST is involved here?
0 Likes
Knowledge Partner
Knowledge Partner

Re: IDM 4.7.1: Calculation error for token-convert-time offset

dgersic <dgersic@no-mx.forums.microfocus.com> wrote:
>
>

Code:
--------------------

> <token-convert-time dest-format="yyyyMMdd" dest-tz="UTC"
> offset="$lv-counter$" offset-unit="day" src-format="yyyyMMdd" src-tz="UTC">
>

--------------------

>
> He runs the rule, and it generates unexpected results for "4 days after

28 March 2019". I run the rule, and it generates the expected results
for the exact same thing.
>
> I'm not seeing how DST is involved here?


The offset is not explicitly defined as 1 day in UTC (you might think so
because of how UTC is specified in token), but I doubt it. Reading the docs
(and past experience) backs me up here.

The underlying class (I think) the token wraps is java.util.date (that is
deprecated in Java, replaced by java.time.*)

The java.util.date class defaults to the Timezone of jre and uses this
implicitly in many cases if not explicitly overridden.

So.. my theory is that, the offset of 1 day is calculated to an “instant”
(milliseconds) in the local time zone - most days this is 24 hours worth of
milliseconds, on a day with DST change, it will either be 25 or 23 hours
worth of milliseconds.

The source date value is parsed from text to an instant (again in
milliseconds since the epoch) based on specified time zone and added to the
offset.

Then this new instance is converted back to the specified destination time
zone.

Alex McHugh - Knowledge Partner - Stavanger, Norway
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.
0 Likes
Knowledge Partner
Knowledge Partner

Re: IDM 4.7.1: Calculation error for token-convert-time offset

Alex McHugh <alexmchugh@no-mx.forums.microfocus.com> wrote:
> dgersic <dgersic@no-mx.forums.microfocus.com> wrote:
>
> The offset is not explicitly defined as 1 day in UTC (you might think so
> because of how UTC is specified in token), but I doubt it. Reading the docs
> (and past experience) backs me up here.
>
> The underlying class (I think) the token wraps is java.util.date (that is
> deprecated in Java, replaced by java.time.*)
>
> The java.util.date class defaults to the Timezone of jre and uses this
> implicitly in many cases if not explicitly overridden.
>
> So.. my theory is that


Thinking about this more. My theory is potentially flawed. However there
has to be a DST related explanation here.

Note poster is in UTC+1 time zone. Most European countries in that zone
will switch to DST on the 31st March this year. Has to be something to do
with that.

I have had similar head scratching issues myself and it has always been DST
as explanation.
Alex McHugh - Knowledge Partner - Stavanger, Norway
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.
0 Likes
Knowledge Partner
Knowledge Partner

Re: IDM 4.7.1: Calculation error for token-convert-time offset

Alex McHugh wrote:

> Alex McHugh <alexmchugh@no-mx.forums.microfocus.com> wrote:
> > dgersic <dgersic@no-mx.forums.microfocus.com> wrote:
> >
> > The offset is not explicitly defined as 1 day in UTC (you might think so
> > because of how UTC is specified in token), but I doubt it. Reading the docs
> > (and past experience) backs me up here.
> >
> > The underlying class (I think) the token wraps is java.util.date (that is
> > deprecated in Java, replaced by java.time.*)
> >
> > The java.util.date class defaults to the Timezone of jre and uses this
> > implicitly in many cases if not explicitly overridden.
> >
> > So.. my theory is that

>
> Thinking about this more. My theory is potentially flawed. However there
> has to be a DST related explanation here.
>


I just tested this and I do think the DST explanation has some validity here.

Changing the calculation to use solely JRE's time zone gives a consistent
answer.
<do-set-local-variable name="lv-DayOffset" scope="policy">
<arg-string>
<token-convert-time dest-format="yyyyMMdd" offset="$lv-counter$"
offset-unit="day" src-format="yyyyMMdd">
<token-local-variable name="lv-today"/>
</token-convert-time>
</arg-string>
</do-set-local-variable>


Remember that each date is parsed into seconds internally by these functions.
If hours, minutes and seconds are left empty, it will assume start of that day,
any timezone shift thereafter can make this appear as the day before or after
(depending on the timezone you are in)

--
If you find this post helpful, and are viewing this using the web, please show
your appreciation by clicking on the star below
Alex McHugh - Knowledge Partner - Stavanger, Norway
Who are the Knowledge Partners
If you appreciate my comments, please click the Like button.
If I have resolved your issue, please click the Accept as Solution button.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.