summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d6078eb)
raw | patch | inline | side by side (parent: d6078eb)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 7 Feb 2010 19:48:01 +0000 (19:48 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 7 Feb 2010 19:48:01 +0000 (19:48 +0000) |
program/configure.ac | patch | blob | history | |
program/src/rrd_graph.c | patch | blob | history |
diff --git a/program/configure.ac b/program/configure.ac
index 235625c937ea7b6bf928fc1d6f3d52e32ad0f901..07231b79dfa159555c2796de735634711732f8d9 100644 (file)
--- a/program/configure.ac
+++ b/program/configure.ac
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
-AC_CHECK_HEADERS(stdint.h inttypes.h libgen.h features.h sys/stat.h sys/types.h fcntl.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/times.h sys/param.h sys/resource.h signal.h float.h stdio.h stdlib.h errno.h string.h ctype.h)
+AC_CHECK_HEADERS(langinfo.h stdint.h inttypes.h libgen.h features.h sys/stat.h sys/types.h fcntl.h fp_class.h malloc.h unistd.h ieeefp.h math.h sys/times.h sys/param.h sys/resource.h signal.h float.h stdio.h stdlib.h errno.h string.h ctype.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
dnl for each function found we get a definition in config.h
dnl of the form HAVE_FUNCTION
-AC_CHECK_FUNCS(tzset fsync mbstowcs opendir readdir chdir chroot getuid strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday)
+AC_CHECK_FUNCS(nl_langinfo tzset fsync mbstowcs opendir readdir chdir chroot getuid strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday)
AC_FUNC_STRERROR_R
index a93fbb1c52708ca3d047630eb587434c6ac29a00..bd7e3c341a2dd3f8934146736f14c3914363bcd0 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
#include <locale.h>
+#ifdef HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+
#include "rrd_graph.h"
#include "rrd_client.h"
}
+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;
+#else
+ first_weekday = 1;
+#endif
+ }
+ return first_weekday;
+}
/* identify the point where the first gridline, label ... gets placed */
tm. tm_sec = 0;
tm. tm_min = 0;
tm. tm_hour = 0;
- tm. tm_mday -= tm.tm_wday - 1; /* -1 because we want the monday */
+ tm. tm_mday -= tm.tm_wday - find_first_weekday();
- if (tm.tm_wday == 0)
- tm. tm_mday -= 7; /* we want the *previous* monday */
+ if (tm.tm_wday == 0 && find_first_weekday() > 0)
+ tm. tm_mday -= 7; /* we want the *previous* week */
break;
case TMT_MONTH: