summaryrefslogtreecommitdiff
path: root/src/hardcopy.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-10 21:28:38 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-10 21:28:38 +0200
commit63d2555c9cefbbeeca3ec87fdd5d241e9488f9dd (patch)
treef96d5dcd14268406b6c78c002f9bb63db7fc9cb9 /src/hardcopy.c
parent4ca41534b726c4116d2e430e877e34146b4d4831 (diff)
downloadvim-git-63d2555c9cefbbeeca3ec87fdd5d241e9488f9dd.tar.gz
patch 8.1.1313: warnings for using localtime() and ctime()v8.1.1313
Problem: Warnings for using localtime() and ctime(). Solution: Use localtime_r() if available. Avoid using ctime().
Diffstat (limited to 'src/hardcopy.c')
-rw-r--r--src/hardcopy.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/hardcopy.c b/src/hardcopy.c
index 1ceed9916..a3b1c0e1f 100644
--- a/src/hardcopy.c
+++ b/src/hardcopy.c
@@ -2723,9 +2723,7 @@ prt_add_resource(struct prt_ps_resource_S *resource)
int
mch_print_begin(prt_settings_T *psettings)
{
- time_t now;
int bbox[4];
- char *p_time;
double left;
double right;
double top;
@@ -2734,7 +2732,6 @@ mch_print_begin(prt_settings_T *psettings)
struct prt_ps_resource_S *res_encoding;
char buffer[256];
char_u *p_encoding;
- char_u *p;
struct prt_ps_resource_S *res_cidfont;
struct prt_ps_resource_S *res_cmap;
int retval = FALSE;
@@ -2761,13 +2758,8 @@ mch_print_begin(prt_settings_T *psettings)
prt_dsc_textline("For", buffer);
prt_dsc_textline("Creator", VIM_VERSION_LONG);
/* Note: to ensure Clean8bit I don't think we can use LC_TIME */
- now = time(NULL);
- p_time = ctime(&now);
- /* Note: ctime() adds a \n so we have to remove it :-( */
- p = vim_strchr((char_u *)p_time, '\n');
- if (p != NULL)
- *p = NUL;
- prt_dsc_textline("CreationDate", p_time);
+
+ prt_dsc_textline("CreationDate", get_ctime(time(NULL), FALSE));
prt_dsc_textline("DocumentData", "Clean8Bit");
prt_dsc_textline("Orientation", "Portrait");
prt_dsc_atend("Pages");