char buf[10], *port;
BDB_POSTGRESQL *mdb = this;
int print_msg=0; /* 1: warning, 2: error, 3 fatal */
+ const char *tz = get_timezone();
P(mutex);
if (mdb->m_connected) {
sql_query("SET cursor_tuple_fraction=1");
sql_query("SET client_min_messages TO WARNING");
+ /* For the Timezone to the current director one */
+ if (tz && *tz) {
+ Mmsg(mdb->cmd, "SET timezone = '%s'", tz);
+ sql_query(mdb->cmd);
+ }
+
/*
* Tell PostgreSQL we are using standard conforming strings and avoid warnings such as:
* WARNING: nonstandard use of \\ in a string literal
bool no_signals = false;
char *uid = NULL;
char *gid = NULL;
-
init_working_directory();
/* DELETE ME when bugs in MA1512, MA1632 MA1639 are fixed */
MA1512_reload_job_end_cb = reload_job_end_cb;
return (dirs->size() > 0) ? 0 : -1;
}
+static pthread_once_t tz_control = PTHREAD_ONCE_INIT;
+static void init_timezone()
+{
+#ifdef HAVE_TZSET
+ tzset();
+
+#elif defined(HAVE_WIN32)
+ _tzset();
+#endif
+}
+
+const char *get_timezone()
+{
+ if (pthread_once(&tz_control, init_timezone) != 0) {
+ /* Should not fail, but tzname is initialized to GMT if needed */
+ Dmsg0(0, "pthread_once() call for init_timezone() failed\n");
+ }
+#ifdef HAVE_TZSET
+ if (*tzname[1]) {
+ return tzname[1];
+
+ } else if (*tzname[0]) {
+ return tzname[0];
+ }
+#endif
+ return "";
+}
+
#ifdef TEST_PROGRAM
#include "unittests.h"
void display_collector_types(HPKT &hpkt);
/* bsys.c */
+const char *get_timezone();
int get_user_home_directory(const char *user, POOLMEM *&home);
int get_home_directories(const char *grpname, alist *dirs);
char *ucfirst(char *dest, const char *src, int len);