Simplify get_item_hour() and get_item_min() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
061f74108b
commit
65fb1ff8b1
22
src/utils.c
22
src/utils.c
@ -472,32 +472,22 @@ is_all_digit (char *string)
|
||||
long
|
||||
get_item_time (long date)
|
||||
{
|
||||
return (long)(get_item_hour (date) * HOURINSEC
|
||||
+ get_item_min (date) * MININSEC);
|
||||
return (long)(get_item_hour (date) * HOURINSEC +
|
||||
get_item_min (date) * MININSEC);
|
||||
}
|
||||
|
||||
int
|
||||
get_item_hour (long date)
|
||||
{
|
||||
struct tm *lt;
|
||||
time_t t;
|
||||
|
||||
t = (time_t)date;
|
||||
lt = localtime (&t);
|
||||
|
||||
return lt->tm_hour;
|
||||
time_t t = (time_t)date;
|
||||
return (localtime (&t))->tm_hour;
|
||||
}
|
||||
|
||||
int
|
||||
get_item_min (long date)
|
||||
{
|
||||
struct tm *lt;
|
||||
time_t t;
|
||||
|
||||
t = (time_t)date;
|
||||
lt = localtime (&t);
|
||||
|
||||
return lt->tm_min;
|
||||
time_t t = (time_t)date;
|
||||
return (localtime (&t))->tm_min;
|
||||
}
|
||||
|
||||
long
|
||||
|
Loading…
x
Reference in New Issue
Block a user