SubWCRev and Utc

30 views
Skip to first unread message

Adam Barnes

unread,
Nov 12, 2018, 10:57:12 AM11/12/18
to TortoiseSVN
Hello, I have noticed that in SubWCRev the behaviour of $WCDATEUTC$ is not quite correct.
When including a format for the datetime the offset of the current timezone is used, this should not be the case.
The time when displayed as Utc should have a +00:00 offset.
Take this example:

$WCDATEUTC=%Y-%m-%dT%H:%M:%S%z$
$WCDATE=%Y-%m-%dT%H:%M:%S%z$

Run it through SubWCRev with your timezone set to somewhere with a non zero offset.
You will see something like the following:

2018-11-12T13:57:56+0100
2018-11-12T14:57:56+0100
 
Note the offset. The time has been converted correctly but the offset has been forgotten about.

I am running TortoiseSVN 1.11.0, Build 28416 - 64 Bit , 2018/10/30 19:14:39
ipv6 enabled
Subversion 1.11.0, -release
apr 1.6.5
apr-util 1.6.1
serf 1.3.9
OpenSSL 1.1.0i  14 Aug 2018
zlib 1.2.11
SQLite 3.23.1

Thank you
Adam

Stefan

unread,
Nov 17, 2018, 3:21:00 AM11/17/18
to TortoiseSVN


On Monday, November 12, 2018 at 4:57:12 PM UTC+1, Adam Barnes wrote:

$WCDATEUTC=%Y-%m-%dT%H:%M:%S%z$
$WCDATE=%Y-%m-%dT%H:%M:%S%z$

You append %z also to $WCDATEUTC, so why are you surprised that it shows?
The %z means "the offset from UTC in ISO8601 format; no characters if time zone is unknown".  Meaning that %z shows the offset from your local time zone, no matter what time is passed to the strftime() function.
Just don't add %z to the string and you're fine.

Stefan


Adam Barnes

unread,
Nov 19, 2018, 4:54:04 AM11/19/18
to TortoiseSVN
Hi Stefan,

For my purposes I want the offset format of ISO8601. I am aware that the formatting of SubWCRev seems to use RFC3339, which is fine form my purposes.
Having looked at the code I can see that you use standard lib functions for time conversion and formatting, so understand your position and agree that this behaviour is down to the lib functions.

From my perspective I get a different result than was expected due to the result of $WCDATEUTC=%Y-%m-%dT%H:%M:%S%z$ containing time data from two different bases.
Using a format of $WCDATEUTC=%Y-%m-%dT%H:%M:%S+0000$ gets me what I need.

I believe this to be relevant here:
     "If a struct tm broken-down time structure is created or modified by gmtime() or gmtime_r(), 
      it is unspecified whether the result of the %Z and %z conversion specifiers shall refer to UTC or the current local timezone, 
      when strftime() is called with such a broken-down time structure."

Thanks for your help
Adam
Reply all
Reply to author
Forward
0 new messages