mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* src/engine/io-gncxml-r.c (gnc_book_load_from_xml_file): use
TZ=UTC while parsing xml. * src/engine/sixtp-utils.c: adjust for timezone offset manually git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3770 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
f27cb73c90
commit
52585c28a0
@ -1,5 +1,10 @@
|
||||
2001-03-12 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/engine/io-gncxml-r.c (gnc_book_load_from_xml_file): use
|
||||
TZ=UTC while parsing xml.
|
||||
|
||||
* src/engine/sixtp-utils.c: adjust for timezone offset manually
|
||||
|
||||
* src/scm/html-table.scm ((gnc:make-html-table-header-cell/markup
|
||||
markup . objects)): new func
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
@ -295,6 +296,8 @@ gnc_book_load_from_xml_file(GNCBook *book)
|
||||
sixtp *top_level_pr;
|
||||
GNCParseStatus global_parse_status;
|
||||
const gchar *filename;
|
||||
char *put_str;
|
||||
char *old_tz;
|
||||
|
||||
g_return_val_if_fail(book, FALSE);
|
||||
|
||||
@ -304,12 +307,20 @@ gnc_book_load_from_xml_file(GNCBook *book)
|
||||
top_level_pr = gncxml_setup_for_read (&global_parse_status);
|
||||
g_return_val_if_fail(top_level_pr, FALSE);
|
||||
|
||||
old_tz = g_strdup (getenv ("TZ"));
|
||||
putenv ("TZ=UTC");
|
||||
|
||||
parse_ok = sixtp_parse_file(top_level_pr,
|
||||
filename,
|
||||
NULL,
|
||||
&global_parse_status,
|
||||
&parse_result);
|
||||
|
||||
put_str = g_strdup_printf ("TZ=%s", old_tz ? old_tz : "");
|
||||
putenv (put_str);
|
||||
g_free (put_str);
|
||||
g_free (old_tz);
|
||||
|
||||
sixtp_destroy(top_level_pr);
|
||||
|
||||
if(parse_ok) {
|
||||
|
@ -364,6 +364,7 @@ string_to_timespec_secs(const gchar *str, Timespec *ts) {
|
||||
struct tm parsed_time;
|
||||
const gchar *strpos;
|
||||
time_t parsed_secs;
|
||||
long int gmtoff;
|
||||
|
||||
memset(&parsed_time, 0, sizeof(struct tm));
|
||||
|
||||
@ -396,9 +397,10 @@ string_to_timespec_secs(const gchar *str, Timespec *ts) {
|
||||
if((sign != '+') && (sign != '-')) return(FALSE);
|
||||
if(!isspace_str(strpos + num_read, -1)) return(FALSE);
|
||||
|
||||
parsed_time.tm_gmtoff = (h1 * 10 + h2) * 60 * 60;
|
||||
parsed_time.tm_gmtoff += (m1 * 10 + m2) * 60;
|
||||
if(sign == '-') parsed_time.tm_gmtoff = - parsed_time.tm_gmtoff;
|
||||
gmtoff = (h1 * 10 + h2) * 60 * 60;
|
||||
gmtoff += (m1 * 10 + m2) * 60;
|
||||
if(sign == '-') gmtoff = - gmtoff;
|
||||
|
||||
parsed_time.tm_isdst = -1;
|
||||
}
|
||||
|
||||
@ -406,6 +408,8 @@ string_to_timespec_secs(const gchar *str, Timespec *ts) {
|
||||
|
||||
if(parsed_secs == (time_t) -1) return(FALSE);
|
||||
|
||||
parsed_secs -= gmtoff;
|
||||
|
||||
ts->tv_sec = parsed_secs;
|
||||
|
||||
return(TRUE);
|
||||
|
Loading…
Reference in New Issue
Block a user