I am trying to understand how yyTimezone
is calculated in code below:
| bare_time '+' tUNUMBER {
/* "7:14+0700" */
yyDSTmode = DSToff;
yyTimezone = - ($3 % 100 + ($3 / 100) * 60);
}
| bare_time '-' tUNUMBER {
/* "19:14:12-0530" */
yyDSTmode = DSToff;
yyTimezone = + ($3 % 100 + ($3 / 100) * 60);
}
How I understand is, lets say the timestamp is 2011-01-02T10:15:20-04:00
; this means its 0400
hours behind UTC
. So to convert it into UTC
, you add 0400
hours to it and it becomes 2011-01-02T14:15:20
. Is my understanding correct?
How is that achieved in the codeblock I pasted above?