Use new time format in day headers.
This commit is contained in:
parent
1ea26690e5
commit
2af789884e
1 changed files with 40 additions and 24 deletions
64
ui.c
64
ui.c
|
|
@ -443,19 +443,13 @@ chtype oldbg;
|
||||||
if (lastday != entry_day(en)) {
|
if (lastday != entry_day(en)) {
|
||||||
struct tm *lt;
|
struct tm *lt;
|
||||||
wchar_t lbl[128];
|
wchar_t lbl[128];
|
||||||
time_t itime = entry_time_for_day(entry_day(en), 1, 0),
|
wchar_t *itime = maketime(entry_time_for_day(entry_day(en), 1, 0)),
|
||||||
ntime = entry_time_for_day(entry_day(en), 0, 0),
|
*ntime = maketime(entry_time_for_day(entry_day(en), 0, 0)),
|
||||||
btime = entry_time_for_day(entry_day(en), 2, bill_increment);
|
*btime = maketime(entry_time_for_day(entry_day(en), 2, bill_increment)),
|
||||||
int hi, mi, si,
|
*ttime = maketime(entry_time_for_day(entry_day(en), 1, 0) +
|
||||||
hn, mn, sn,
|
entry_time_for_day(entry_day(en), 0, 0));
|
||||||
hb, mb, sb,
|
|
||||||
ht, mt, st;
|
|
||||||
wchar_t hdrtext[256];
|
wchar_t hdrtext[256];
|
||||||
|
int n = 0;
|
||||||
time_to_hms(itime, hi, mi, si);
|
|
||||||
time_to_hms(ntime, hn, mn, sn);
|
|
||||||
time_to_hms(btime, hb, mb, sb);
|
|
||||||
time_to_hms(itime + ntime, ht, mt, st);
|
|
||||||
|
|
||||||
oldbg = getbkgd(listwin);
|
oldbg = getbkgd(listwin);
|
||||||
wbkgdset(listwin, style_bg(sy_entry));
|
wbkgdset(listwin, style_bg(sy_entry));
|
||||||
|
|
@ -474,18 +468,40 @@ chtype oldbg;
|
||||||
lt = localtime(&lastday);
|
lt = localtime(&lastday);
|
||||||
|
|
||||||
wcsftime(lbl, wsizeof(lbl), L"%A, %d %B %Y", lt);
|
wcsftime(lbl, wsizeof(lbl), L"%A, %d %B %Y", lt);
|
||||||
if (show_billable)
|
swprintf(hdrtext, wsizeof(hdrtext), L"%-30ls [", lbl);
|
||||||
swprintf(hdrtext, wsizeof(hdrtext),
|
|
||||||
L"%-30ls [I:%02d:%02d:%02d / "
|
if (*itime) {
|
||||||
L"N:%02d:%02d:%02d / T:%02d:%02d:%02d / "
|
wcslcat(hdrtext, L"I:", wsizeof(hdrtext));
|
||||||
L"B:%02d:%02d:%02d]",
|
wcslcat(hdrtext, itime, wsizeof(hdrtext));
|
||||||
lbl, hi, mi, si, hn, mn, sn, ht, mt, st,
|
free(itime);
|
||||||
hb, mb, sb);
|
n++;
|
||||||
else
|
}
|
||||||
swprintf(hdrtext, wsizeof(hdrtext),
|
|
||||||
L"%-30ls [I:%02d:%02d:%02d / "
|
if (*ntime) {
|
||||||
L"N:%02d:%02d:%02d / T:%02d:%02d:%02d]",
|
if (n++)
|
||||||
lbl, hi, mi, si, hn, mn, sn, ht, mt, st);
|
wcslcat(hdrtext, L" ", wsizeof(hdrtext));
|
||||||
|
wcslcat(hdrtext, L"N:", wsizeof(hdrtext));
|
||||||
|
wcslcat(hdrtext, ntime, wsizeof(hdrtext));
|
||||||
|
free(ntime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*ttime) {
|
||||||
|
if (n++)
|
||||||
|
wcslcat(hdrtext, L" ", wsizeof(hdrtext));
|
||||||
|
wcslcat(hdrtext, L"T:", wsizeof(hdrtext));
|
||||||
|
wcslcat(hdrtext, ttime, wsizeof(hdrtext));
|
||||||
|
free(ttime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*btime) {
|
||||||
|
if (n++)
|
||||||
|
wcslcat(hdrtext, L" ", wsizeof(hdrtext));
|
||||||
|
wcslcat(hdrtext, L"B:", wsizeof(hdrtext));
|
||||||
|
wcslcat(hdrtext, btime, wsizeof(hdrtext));
|
||||||
|
free(btime);
|
||||||
|
}
|
||||||
|
|
||||||
|
wcslcat(hdrtext, L"]", wsizeof(hdrtext));
|
||||||
|
|
||||||
wattr_on(listwin, style_fg(sy_date), NULL);
|
wattr_on(listwin, style_fg(sy_date), NULL);
|
||||||
wbkgdset(listwin, style_bg(sy_date));
|
wbkgdset(listwin, style_bg(sy_date));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue