From f28b4f793991357bc392514da5ff4c44bdcae394 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sun, 7 Feb 2010 19:55:47 +0000 Subject: [PATCH] use _NL_TIME_WEEK_1STDAY to determin the first day of the week. git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@2018 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_graph.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index bd7e3c34..390a66ec 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -1364,7 +1364,11 @@ static int find_first_weekday(void){ static int first_weekday = -1; if (first_weekday == -1){ #if defined(HAVE_NL_LANGINFO) - first_weekday = nl_langinfo(_NL_TIME_FIRST_WEEKDAY)[0] - 1; + /* according to http://sourceware.org/ml/libc-locales/2009-q1/msg00011.html */ + long week_1stday_l = (long) nl_langinfo (_NL_TIME_WEEK_1STDAY); + if (week_1stday_l == 19971130) first_weekday = 0; /* Sun */ + else if (week_1stday_l == 19971201) first_weekday = 1; /* Mon */ + else first_weekday = 1; /* we go for a monday default */ #else first_weekday = 1; #endif -- 2.30.2