[libvirt] [PATCHv2 1/4] util: new function virTimeLocalOffsetFromUTC

Eric Blake eblake at redhat.com
Fri May 23 12:47:32 UTC 2014


On 05/23/2014 05:43 AM, Laine Stump wrote:

>> man tzset:
>>
>>        The second format is used when there is daylight saving time:
>>
>>               std offset dst [offset],start[/time],end[/time]
> 
> Aha! And combining that with the "VIR" timezone idea that we're already
> using, I've found that the following string *does* set DST:
> 
> TZ="VIR02:30VID,0,365"
> 

That probably still has a window where running 'make check' on Dec 31
may fail; maybe using the time argument as in /23:59 will minimize the
window to one minute?

> while the following *doesn't* (at least not today :-):
> 
> TZ="VIR02:30VID,300,365"
> 
> So I can add the former as a test case.

It's awkward testing for daylight savings cases if the test is dependent
on today's date; hopefully whatever you come up with is sufficiently
isolated that it doesn't introduce spurious failures on certain days of
the year.

Also, if I understand correctly, once you have a TZ with daylight
savings rules, the tm_isdst of struct tm can be set to negative to use
the TZ rules for determining if it is in effect, to 0 to force the
standard time (even if the current time is during dst) and to 1 to force
the daylight time (even if the current time is during std).  (And that
this is true for tm_isdst, but NOT for the global 'daylight', which is
merely specified as positive year-round if TZ includes daylight rules).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140523/1c8e80b7/attachment-0001.sig>


More information about the libvir-list mailing list