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
|
long
|
||||||
get_item_time (long date)
|
get_item_time (long date)
|
||||||
{
|
{
|
||||||
return (long)(get_item_hour (date) * HOURINSEC
|
return (long)(get_item_hour (date) * HOURINSEC +
|
||||||
+ get_item_min (date) * MININSEC);
|
get_item_min (date) * MININSEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get_item_hour (long date)
|
get_item_hour (long date)
|
||||||
{
|
{
|
||||||
struct tm *lt;
|
time_t t = (time_t)date;
|
||||||
time_t t;
|
return (localtime (&t))->tm_hour;
|
||||||
|
|
||||||
t = (time_t)date;
|
|
||||||
lt = localtime (&t);
|
|
||||||
|
|
||||||
return lt->tm_hour;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get_item_min (long date)
|
get_item_min (long date)
|
||||||
{
|
{
|
||||||
struct tm *lt;
|
time_t t = (time_t)date;
|
||||||
time_t t;
|
return (localtime (&t))->tm_min;
|
||||||
|
|
||||||
t = (time_t)date;
|
|
||||||
lt = localtime (&t);
|
|
||||||
|
|
||||||
return lt->tm_min;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long
|
long
|
||||||
|
Loading…
x
Reference in New Issue
Block a user