mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
Make sure time is valid for uptime (bug 1214)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2417 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
cli.c
2
cli.c
@@ -186,6 +186,8 @@ static char *format_uptimestr(time_t timeval)
|
|||||||
#define WEEK (DAY*7)
|
#define WEEK (DAY*7)
|
||||||
#define YEAR (DAY*365)
|
#define YEAR (DAY*365)
|
||||||
|
|
||||||
|
if (timeval < 0)
|
||||||
|
return NULL;
|
||||||
if (timeval > YEAR) {
|
if (timeval > YEAR) {
|
||||||
years = (timeval / YEAR);
|
years = (timeval / YEAR);
|
||||||
timeval -= (years * YEAR);
|
timeval -= (years * YEAR);
|
||||||
|
|||||||
Reference in New Issue
Block a user