diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2023-11-24 02:47:51 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2023-11-24 02:47:51 +0000 |
commit | bf0efcc9e49b4bc993b61e7ecc1c8b1a4ee00251 (patch) | |
tree | b3a840a2eaad394f90679e8a4cce5f8030ec45ba | |
parent | 46dea544777f3f77bf9eb8efe2c8ca75206a9dcc (diff) |
calculate time zone offset in the same way as in pdftex
git-svn-id: svn://tug.org/texlive/trunk@68952 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 5 | ||||
-rwxr-xr-x | Build/source/texk/dvipdfm-x/configure | 22 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/configure.ac | 2 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dpxutil.c | 100 |
4 files changed, 60 insertions, 69 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 0d24958d8c5..af85c6377cf 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,8 @@ +2023-11-24 Akira Kakuto <kakuto@jcom.zaq.ne.jp> + * dpxutil.c: Calculate time zone offset in the same way as + in pdftex. + * configure.ac: version 20231124. + 2023-11-18 Yukimasa Morimi <h20y6m@yahoo.co.jp> * cidtype2.c, unicode.c: Support for new Adobe-Japan1-UCS2 CMap. diff --git a/Build/source/texk/dvipdfm-x/configure b/Build/source/texk/dvipdfm-x/configure index 58f92332582..51faad01e07 100755 --- a/Build/source/texk/dvipdfm-x/configure +++ b/Build/source/texk/dvipdfm-x/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for dvipdfm-x (TeX Live) 20231118. +# Generated by GNU Autoconf 2.71 for dvipdfm-x (TeX Live) 20231124. # # Report bugs to <dvipdfmx@tug.org>. # @@ -629,8 +629,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dvipdfm-x (TeX Live)' PACKAGE_TARNAME='dvipdfm-x--tex-live-' -PACKAGE_VERSION='20231118' -PACKAGE_STRING='dvipdfm-x (TeX Live) 20231118' +PACKAGE_VERSION='20231124' +PACKAGE_STRING='dvipdfm-x (TeX Live) 20231124' PACKAGE_BUGREPORT='dvipdfmx@tug.org' PACKAGE_URL='' @@ -1396,7 +1396,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dvipdfm-x (TeX Live) 20231118 to adapt to many kinds of systems. +\`configure' configures dvipdfm-x (TeX Live) 20231124 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1468,7 +1468,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20231118:";; + short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20231124:";; esac cat <<\_ACEOF @@ -1598,7 +1598,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dvipdfm-x (TeX Live) configure 20231118 +dvipdfm-x (TeX Live) configure 20231124 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2354,7 +2354,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dvipdfm-x (TeX Live) $as_me 20231118, which was +It was created by dvipdfm-x (TeX Live) $as_me 20231124, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -8795,7 +8795,7 @@ fi # Define the identity of the package. PACKAGE='dvipdfm-x--tex-live-' - VERSION='20231118' + VERSION='20231124' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -15801,7 +15801,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -dvipdfm-x (TeX Live) config.lt 20231118 +dvipdfm-x (TeX Live) config.lt 20231124 configured by $0, generated by GNU Autoconf 2.71. Copyright (C) 2011 Free Software Foundation, Inc. @@ -17723,7 +17723,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dvipdfm-x (TeX Live) $as_me 20231118, which was +This file was extended by dvipdfm-x (TeX Live) $as_me 20231124, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17795,7 +17795,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -dvipdfm-x (TeX Live) config.status 20231118 +dvipdfm-x (TeX Live) config.status 20231124 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/dvipdfm-x/configure.ac b/Build/source/texk/dvipdfm-x/configure.ac index fcc32d26421..b4b9a14f8fc 100644 --- a/Build/source/texk/dvipdfm-x/configure.ac +++ b/Build/source/texk/dvipdfm-x/configure.ac @@ -8,7 +8,7 @@ dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl -AC_INIT([dvipdfm-x (TeX Live)], [20231118], [dvipdfmx@tug.org]) +AC_INIT([dvipdfm-x (TeX Live)], [20231124], [dvipdfmx@tug.org]) AC_PREREQ([2.65]) AC_CONFIG_SRCDIR([agl.c]) AC_CONFIG_AUX_DIR([../../build-aux]) diff --git a/Build/source/texk/dvipdfm-x/dpxutil.c b/Build/source/texk/dvipdfm-x/dpxutil.c index 379fb515058..c49268ea63c 100644 --- a/Build/source/texk/dvipdfm-x/dpxutil.c +++ b/Build/source/texk/dvipdfm-x/dpxutil.c @@ -1,6 +1,6 @@ /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata, + Copyright (C) 2002-2023 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> @@ -190,80 +190,66 @@ dpx_util_get_unique_time_if_given(void) return ret; } - -#ifndef HAVE_TM_GMTOFF -#ifndef HAVE_TIMEZONE - -/* 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 int32_t -compute_timezone_offset() -{ - time_t now; - struct tm tm; - struct tm local; - time_t gmtoff; - - now = get_unique_time_if_given(); - if (now == INVALID_EPOCH_VALUE) { - now = time(NULL); - localtime_r(&now, &local); - gmtime_r(&now, &tm); - return (mktime(&local) - mktime(&tm)); - } else { - return(0); - } -} - -#endif /* HAVE_TIMEZONE */ -#endif /* HAVE_TM_GMTOFF */ - /* * Docinfo */ +#define TIME_STR_SIZE 30 int dpx_util_format_asn_date (char *date_string, int need_timezone) { - int32_t tz_offset; + int32_t off, off_hours, off_mins; time_t current_time; - struct tm *bd_time; + struct tm bd_time, gmt; + size_t size; current_time = dpx_util_get_unique_time_if_given(); if (current_time == INVALID_EPOCH_VALUE) { time(¤t_time); - bd_time = localtime(¤t_time); - -#ifdef HAVE_TM_GMTOFF - tz_offset = bd_time->tm_gmtoff; -#else -# ifdef HAVE_TIMEZONE - tz_offset = -timezone; -# else - tz_offset = compute_timezone_offset(); -# endif /* HAVE_TIMEZONE */ -#endif /* HAVE_TM_GMTOFF */ + bd_time = *localtime(¤t_time); } else { - bd_time = gmtime(¤t_time); - tz_offset = 0; + bd_time = *gmtime(¤t_time); } + + size = strftime(date_string, TIME_STR_SIZE, "D:%Y%m%d%H%M%S", &bd_time); + /* expected format: "YYYYmmddHHMMSS" */ + if (size == 0) { + /* unexpected, contents of date_string is undefined */ + date_string[0] = '\0'; + return 0; + } + + /* correction for seconds: %S can be in range 00..61, + the PDF reference expects 00..59, + therefore we map "60" and "61" to "59" */ + if (date_string[14] == '6') { + date_string[14] = '5'; + date_string[15] = '9'; + date_string[16] = '\0'; /* for safety */ + } + +/* calculate the time zone offset in the same way as in texmfmp.c */ + gmt = *gmtime(¤t_time); + off = 60 * (bd_time.tm_hour - gmt.tm_hour) + bd_time.tm_min - gmt.tm_min; + if (bd_time.tm_year != gmt.tm_year) { + off += (bd_time.tm_year > gmt.tm_year) ? 1440 : -1440; + } else if (bd_time.tm_yday != gmt.tm_yday) { + off += (bd_time.tm_yday > gmt.tm_yday) ? 1440 : -1440; + } + if (need_timezone) { - if (bd_time->tm_isdst > 0) { - tz_offset += 3600; + if (off == 0) { + date_string[size++] = 'Z'; + date_string[size] = 0; + } else { + off_hours = off / 60; + off_mins = abs(off - off_hours * 60); + sprintf(&date_string[size], "%+03d'%02d'", off_hours, off_mins); } - sprintf(date_string, "D:%04d%02d%02d%02d%02d%02d%c%02d'%02d'", - bd_time->tm_year + 1900, bd_time->tm_mon + 1, bd_time->tm_mday, - bd_time->tm_hour, bd_time->tm_min, bd_time->tm_sec, - (tz_offset > 0) ? '+' : '-', abs(tz_offset) / 3600, - (abs(tz_offset) / 60) % 60); } else { - sprintf(date_string, "D:%04d%02d%02d%02d%02d%02d", - bd_time->tm_year + 1900, bd_time->tm_mon + 1, bd_time->tm_mday, - bd_time->tm_hour, bd_time->tm_min, bd_time->tm_sec); + date_string[size] = 0; } - return strlen(date_string); + return (int)strlen(date_string); } void |