From d3d091029367d7bf3c413330a2e93d720614d211 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 30 Jul 2014 12:10:15 +0100 Subject: 32918: add %. to ztrftime for use in prompts --- Src/prompt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Src/prompt.c') diff --git a/Src/prompt.c b/Src/prompt.c index 95a7d4969..c16d78163 100644 --- a/Src/prompt.c +++ b/Src/prompt.c @@ -270,6 +270,8 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep) char *ss, *hostnam; int t0, arg, test, sep, j, numjobs; struct tm *tm; + struct timezone dummy_tz; + struct timeval tv; time_t timet; Nameddir nd; @@ -636,8 +638,8 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep) tmfmt = "%l:%M%p"; break; } - timet = time(NULL); - tm = localtime(&timet); + gettimeofday(&tv, &dummy_tz); + tm = localtime(&tv.tv_sec); /* * Hack because strftime won't say how * much space it actually needs. Try to add it @@ -647,7 +649,7 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep) */ for(j = 0, t0 = strlen(tmfmt)*8; j < 3; j++, t0*=2) { addbufspc(t0); - if (ztrftime(bv->bp, t0, tmfmt, tm) >= 0) + if (ztrftime(bv->bp, t0, tmfmt, tm, tv.tv_usec) >= 0) break; } /* There is enough room for this because addbufspc(t0) -- cgit 1.4.1