Honour user's time format when editing entry duration.
This commit is contained in:
parent
0479ee0f89
commit
49651c90a2
2 changed files with 8 additions and 1 deletions
7
str.h
7
str.h
|
|
@ -20,6 +20,13 @@
|
||||||
#define TIME_AHMS 2 /* 1h10m37s */
|
#define TIME_AHMS 2 /* 1h10m37s */
|
||||||
#define TIME_AHM 3 /* 1h10w */
|
#define TIME_AHM 3 /* 1h10w */
|
||||||
|
|
||||||
|
#define TIMEFMT_FOR_EDIT(f) \
|
||||||
|
( (f) == TIME_HMS ? TIME_HMS \
|
||||||
|
: (f) == TIME_HM ? TIME_HMS \
|
||||||
|
: (f) == TIME_AHMS ? TIME_AHMS \
|
||||||
|
: (f) == TIME_AHM ? TIME_AHMS \
|
||||||
|
: 0)
|
||||||
|
|
||||||
size_t tokenise (const wchar_t *, wchar_t ***result);
|
size_t tokenise (const wchar_t *, wchar_t ***result);
|
||||||
void tokfree (wchar_t ***);
|
void tokfree (wchar_t ***);
|
||||||
time_t parsetime (const wchar_t *);
|
time_t parsetime (const wchar_t *);
|
||||||
|
|
|
||||||
2
ui.c
2
ui.c
|
|
@ -623,7 +623,7 @@ wchar_t *defstr = NULL;
|
||||||
wchar_t *tstr;
|
wchar_t *tstr;
|
||||||
time_t ret;
|
time_t ret;
|
||||||
|
|
||||||
defstr = maketime(def, TIME_AHMS);
|
defstr = maketime(def, TIMEFMT_FOR_EDIT(time_format));
|
||||||
|
|
||||||
if ((tstr = prompt(pr, defstr, NULL)) == NULL) {
|
if ((tstr = prompt(pr, defstr, NULL)) == NULL) {
|
||||||
free(defstr);
|
free(defstr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue