[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 1/3] Add internal APIs for dealing with time



On Tue, Nov 29, 2011 at 04:21:45PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> The logging APIs need to be able to generate formatted timestamps
> using only async signal safe functions. This rules out using
> gmtime/localtime/malloc/gettimeday(!) and much more.
> 
> Introduce a new internal API which is async signal safe.
> 
>   virTimeMillisNowRaw replacement for gettimeofday. Uses clock_gettime
>                       where available, otherwise falls back to the unsafe
>                       gettimeofday
> 
>   virTimeFieldsNowRaw  replacements for gmtime(), convert a timestamp
>   virTimeFieldsThenRaw into a broken out set of fields. No localtime()
>                        replacement is provided, because converting to
>                        local time is not practical with only async signal
>                        safe APIs.
> 
>   virTimeStringNowRaw  replacements for strftime() which print a timestamp
>   virTimeStringThenRaw into a string, using a pre-determined format, with
>                        a fixed size buffer (VIR_TIME_STRING_BUFLEN)
> 
> For each of these there is also a version without the Raw postfix
> which raises a full libvirt error. These versions are not async
> signal safe

  ACK, I didn't spot anything :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]