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

2014-05-31 Thread Laine Stump
On 05/31/2014 11:11 PM, Roman Bogorodskiy wrote: > Roman Bogorodskiy wrote: > >> Laine Stump wrote: >> >>> Since there isn't a single libc API to get this value, this patch >>> supplies one which gets the value by grabbing current UTC, then >>> converting that into a struct tm with localtime_r(

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

2014-05-31 Thread Roman Bogorodskiy
Roman Bogorodskiy wrote: > Laine Stump wrote: > > > Since there isn't a single libc API to get this value, this patch > > supplies one which gets the value by grabbing current UTC, then > > converting that into a struct tm with localtime_r(), then back to a > > time_t using mktime; it again d

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

2014-05-31 Thread Roman Bogorodskiy
Laine Stump wrote: > Since there isn't a single libc API to get this value, this patch > supplies one which gets the value by grabbing current UTC, then > converting that into a struct tm with localtime_r(), then back to a > time_t using mktime; it again does the same operation, but using > gmti

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

2014-05-23 Thread Laine Stump
On 05/23/2014 05:45 PM, Laine Stump wrote: > On 05/22/2014 10:03 PM, Eric Blake wrote: >> >> It would be a LOT simpler to just do: >> >> #include >> >> tzset(); >> *offset = timezone; >> >> except that some older builds of mingw lack the extern variable >> timezone. Or maybe even do a configure c

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

2014-05-23 Thread Laine Stump
On 05/22/2014 10:03 PM, Eric Blake wrote: > On 05/22/2014 05:07 AM, Laine Stump wrote: >> Since there isn't a single libc API to get this value, this patch >> supplies one which gets the value by grabbing current UTC, then >> converting that into a struct tm with localtime_r(), then back to a >> ti

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

2014-05-23 Thread Laine Stump
On 05/23/2014 03:47 PM, Eric Blake wrote: > 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" timezo

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

2014-05-23 Thread Marcelo Tosatti
On Fri, May 23, 2014 at 02:43:08PM +0300, Laine Stump wrote: > On 05/22/2014 09:49 PM, Marcelo Tosatti wrote: > > On Thu, May 22, 2014 at 02:07:27PM +0300, Laine Stump wrote: > >> Since there isn't a single libc API to get this value, this patch > >> supplies one which gets the value by grabbing cu

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

2014-05-23 Thread Eric Blake
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 t

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

2014-05-23 Thread Laine Stump
On 05/22/2014 09:49 PM, Marcelo Tosatti wrote: > On Thu, May 22, 2014 at 02:07:27PM +0300, Laine Stump wrote: >> Since there isn't a single libc API to get this value, this patch >> supplies one which gets the value by grabbing current UTC, then >> converting that into a struct tm with localtime_r(

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

2014-05-22 Thread Marcelo Tosatti
On Thu, May 22, 2014 at 02:07:27PM +0300, Laine Stump wrote: > Since there isn't a single libc API to get this value, this patch > supplies one which gets the value by grabbing current UTC, then > converting that into a struct tm with localtime_r(), then back to a > time_t using mktime; it again do

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

2014-05-22 Thread Eric Blake
On 05/22/2014 05:07 AM, Laine Stump wrote: > Since there isn't a single libc API to get this value, this patch > supplies one which gets the value by grabbing current UTC, then > converting that into a struct tm with localtime_r(), then back to a > time_t using mktime; it again does the same operat

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

2014-05-22 Thread Eric Blake
On 05/22/2014 05:07 AM, Laine Stump wrote: > Since there isn't a single libc API to get this value, this patch > supplies one which gets the value by grabbing current UTC, then > converting that into a struct tm with localtime_r(), then back to a > time_t using mktime; it again does the same operat

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

2014-05-22 Thread Laine Stump
Since there isn't a single libc API to get this value, this patch supplies one which gets the value by grabbing current UTC, then converting that into a struct tm with localtime_r(), then back to a time_t using mktime; it again does the same operation, but using gmtime_r() instead (for UTC). It the