mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Check the return value of the gettimeofday() in 'jerry_port_get_time_zone' and 'jerry_port_get_current_time' functions.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
parent
3de4170c15
commit
94161d350a
@ -65,5 +65,5 @@ int
|
||||
gettimeofday (void *tp __attr_unused___, /**< struct timeval */
|
||||
void *tzp __attr_unused___) /**< struct timezone */
|
||||
{
|
||||
return 0;
|
||||
return -1;
|
||||
} /* gettimeofday */
|
||||
|
||||
@ -32,7 +32,10 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
|
||||
tz.tz_minuteswest = 0;
|
||||
tz.tz_dsttime = 0;
|
||||
|
||||
gettimeofday (&tv, &tz);
|
||||
if (gettimeofday (&tv, &tz) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
tz_p->offset = tz.tz_minuteswest;
|
||||
tz_p->daylight_saving_time = tz.tz_dsttime > 0 ? 1 : 0;
|
||||
@ -47,7 +50,10 @@ double jerry_port_get_current_time ()
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday (&tv, NULL);
|
||||
if (gettimeofday (&tv, NULL) != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ((double) tv.tv_sec) * 1000.0 + ((double) tv.tv_usec) / 1000.0;
|
||||
} /* jerry_port_get_current_time */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user