summaryrefslogtreecommitdiff
path: root/Src/prompt.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2014-07-30 12:10:15 +0100
committerPeter Stephenson <pws@zsh.org>2014-07-30 12:10:15 +0100
commitd3d091029367d7bf3c413330a2e93d720614d211 (patch)
treebcbf3a576dea7de1259114fc5e8df6270350fe16 /Src/prompt.c
parent0442410c681b6b4e9ca0d25b22ed78e7989d5e29 (diff)
downloadzsh-d3d091029367d7bf3c413330a2e93d720614d211.tar.gz
zsh-d3d091029367d7bf3c413330a2e93d720614d211.zip
32918: add %. to ztrftime for use in prompts
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c8
1 files changed, 5 insertions, 3 deletions
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)