From 0a9b0dd07049b644a10ee920497a163ce6e23967 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 May 2010 23:54:03 +0200 Subject: [PATCH] command: fallback strftime() formats on WIN32 On WIN32, "%F" and "%T" are not implemented. --- src/command.c | 6 ++++-- src/song_print.c | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/command.c b/src/command.c index d514d0698..df0146c16 100644 --- a/src/command.c +++ b/src/command.c @@ -387,10 +387,12 @@ print_spl_list(struct client *client, GPtrArray *list) client_printf(client, "playlist: %s\n", playlist->name); t = playlist->mtime; - strftime(timestamp, sizeof(timestamp), "%FT%TZ", -#ifdef WIN32 + strftime(timestamp, sizeof(timestamp), +#ifdef G_OS_WIN32 + "%Y-%m-%dT%H:%M:%SZ", gmtime(&t) #else + "%FT%TZ", gmtime_r(&t, &tm) #endif ); diff --git a/src/song_print.c b/src/song_print.c index 831688483..034c1d013 100644 --- a/src/song_print.c +++ b/src/song_print.c @@ -79,7 +79,13 @@ song_print_info(struct client *client, struct song *song) if (tm2 != NULL) { char timestamp[32]; - strftime(timestamp, sizeof(timestamp), "%FT%TZ", tm2); + strftime(timestamp, sizeof(timestamp), +#ifdef G_OS_WIN32 + "%Y-%m-%dT%H:%M:%SZ", +#else + "%FT%TZ", +#endif + tm2); client_printf(client, "Last-Modified: %s\n", timestamp); }