diff options
author | Karl Berry <karl@freefriends.org> | 2006-12-21 01:14:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-12-21 01:14:57 +0000 |
commit | e788a995dffb55633861e0cc2a728b3e56384287 (patch) | |
tree | 48d59921752e3df272632ee8a0f8131fc6d96bf9 | |
parent | cd841589f4c33a97df820008421c61b888421bd2 (diff) |
(compute_timezone_offset): new fn, from Apostolos.
(asn_date): call it, if neither tm_gmtoff nor
timezone is present.
git-svn-id: svn://tug.org/texlive/trunk@2831 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfdoc.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Build/source/texk/dvipdfmx/src/pdfdoc.c b/Build/source/texk/dvipdfmx/src/pdfdoc.c index 3e3604cbe60..eba290014c9 100644 --- a/Build/source/texk/dvipdfmx/src/pdfdoc.c +++ b/Build/source/texk/dvipdfmx/src/pdfdoc.c @@ -484,6 +484,23 @@ pdf_doc_set_eop_content (const char *content, unsigned length) return; } +/* auxiliary function to compute timezone offset on + systems that do not support the tm_gmtoff in struct tm, + or have a timezone variable. Such as i386-solaris. */ + +static long +compute_timezone_offset() +{ + const time_t now = time(NULL); + struct tm tm; + struct tm local; + time_t gmtoff; + + localtime_r(&now, &local); + gmtime_r(&now, &tm); + return (mktime(&local) - mktime(&tm)); +} + /* * Docinfo */ @@ -494,7 +511,7 @@ asn_date (char *date_string) # ifdef HAVE_TM_GMTOFF # define timezone (-bd_time->tm_gmtoff) # else -# define timezone 0l +# define timezone (-compute_timezone_offset()) # endif /* not HAVE_TM_GMTOFF */ #endif /* not HAVE_TIMEZONE */ time_t current_time; |