From fad8dc75813b35720ca4441bce1e73f578b2f4b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 25 Feb 2012 15:16:10 +0000 Subject: [PATCH] [INTERPRETER] * NEW: 't' and 'tt' are two new date formatting patterns that display the timezone. git-svn-id: svn://localhost/gambas/trunk@4507 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- main/gbx/gbx_local.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/main/gbx/gbx_local.c b/main/gbx/gbx_local.c index 0bc7333dd..933460003 100644 --- a/main/gbx/gbx_local.c +++ b/main/gbx/gbx_local.c @@ -1262,7 +1262,16 @@ static bool add_date_token(DATE_SERIAL *date, char *token, int count) } break; - + + case 't': + + if (count <= 2) + { + time_t t = (time_t)0L; + localtime_r(&t, &tm); + add_strftime(count == 2 ? "%z" : "%Z", &tm); + } + break; } *token = 0; @@ -1397,13 +1406,10 @@ bool LOCAL_format_date(const DATE_SERIAL *date, int fmt_type, const char *fmt, i continue; } - if (c == 'd' || c == 'm' || c == 'y' || c == 'h' || c == 'n' || c == 's' || c == 'u') + if (c == 'd' || c == 'm' || c == 'y' || c == 'h' || c == 'n' || c == 's' || c == 'u' || c == 't') { if (c != token) { - if (token == 'h' && c == 'm') - c = 'n'; - add_date_token(&vdate, &token, token_count); token = c;