Yes, but glib's date and time functions simply will not suffice here.
While it won't prevent a race condition, I tried to make it a little safer
by copying the content of libc's static buffer to my own. Which gives a
better chance of the function not reading it while some other thread is
calling
this was a useful remark...
nesciens
> --- On Tue, 11/4/08, Daniel Chokola <[EMAIL PROTECTED]> wrote:
> From: Daniel Chokola <[EMAIL PROTECTED]>
> Subject: Re: [PATCH] Log timestamps, fixed tabs, const-ness fix
> To: "Anders Waldenborg" <[EMAIL PROTECTED]>
> Cc: x
AIL PROTECTED]> wrote:
From: Daniel Chokola <[EMAIL PROTECTED]>
Subject: Re: [PATCH] Log timestamps, fixed tabs, const-ness fix
To: "Anders Waldenborg" <[EMAIL PROTECTED]>
Cc: xmms2-devel@lists.xmms.se
Date: Tuesday, November 4, 2008, 4:05 PM
Anders Waldenborg wrot
Perhaps, if we didn't care about having the ability to use hour, second,
and minute formatting directives.
On Tue, Nov 04, 2008 at 10:05:14AM -0500, Daniel Chokola wrote:
> g_get_current_time, g_date_set_time_val, and g_date_strftime should do
> the trick.
>
> http://library.gnome.org/devel/glib/
Not if you want to use time-related formatting directives.
g_date_strftime will only accept date directives, everything else
yields undefined results, and expects to
be passed a pointer to a GDate struct.
On Tue, Nov 04, 2008 at 12:11:28PM +0100, Anders Waldenborg wrote:
> [EMAIL PROTECTED] wrote
Anders Waldenborg wrote:
[EMAIL PROTECTED] wrote:
+time_t tv=time(NULL);
+struct tm st;
+#ifdef _POSIX_C_SOURCE
+localtime_r(&tv,&st);
+#else
+memcpy(&st,localtime(&tv),sizeof(struct tm));
+#endif
Isn't there some nice glib stuff for this?
anders
g_get_current_time, g_date_s
[EMAIL PROTECTED] wrote:
+ time_t tv=time(NULL);
+ struct tm st;
+#ifdef _POSIX_C_SOURCE
+ localtime_r(&tv,&st);
+#else
+ memcpy(&st,localtime(&tv),sizeof(struct tm));
+#endif
Isn't there some nice glib stuff for this?
anders
--
__
---
src/includepriv/xmmspriv/xmms_log.h |2 +-
src/xmms/log.c | 32
src/xmms/main.c |7 +--
3 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/src/includepriv/xmmspriv/xmms_log.h
b/src/includepriv