Simplify now() and nowstr() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
aaa000cd5a
commit
1fc9c69e43
10
src/utils.c
10
src/utils.c
@ -766,20 +766,16 @@ get_today (void)
|
|||||||
long
|
long
|
||||||
now (void)
|
now (void)
|
||||||
{
|
{
|
||||||
time_t current_time;
|
return (long)time (NULL);
|
||||||
|
|
||||||
current_time = time (NULL);
|
|
||||||
return (current_time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
nowstr (void)
|
nowstr (void)
|
||||||
{
|
{
|
||||||
static char buf[BUFSIZ];
|
static char buf[BUFSIZ];
|
||||||
time_t now;
|
time_t t = now ();
|
||||||
|
|
||||||
(void)time (&now);
|
(void)strftime (buf, sizeof buf, "%a %b %d %T %Y", localtime (&t));
|
||||||
(void)strftime (buf, sizeof buf, "%a %b %d %T %Y", localtime (&now));
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user