Change current time from uint64_t to double in Date Port API

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss 2016-04-21 14:51:31 +02:00
parent 80bfb61b13
commit 68f3465eb5
3 changed files with 4 additions and 5 deletions

View File

@ -447,7 +447,7 @@ ecma_builtin_date_now (ecma_value_t this_arg __attr_unused___) /**< this argumen
{
ecma_number_t *now_num_p = ecma_alloc_number ();
*now_num_p = (ecma_number_t) jerry_port_get_current_time ();
*now_num_p = DOUBLE_TO_ECMA_NUMBER_T (jerry_port_get_current_time ());
return ecma_make_number_value (now_num_p);
} /* ecma_builtin_date_now */

View File

@ -18,7 +18,6 @@
#define JERRY_PORT_H
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#ifdef __cplusplus
@ -99,7 +98,7 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p);
*
* @return milliseconds since Unix epoch
*/
uint64_t jerry_port_get_current_time (void);
double jerry_port_get_current_time (void);
/**
* @}

View File

@ -43,11 +43,11 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
/**
* Default implementation of jerry_port_get_current_time.
*/
uint64_t jerry_port_get_current_time ()
double jerry_port_get_current_time ()
{
struct timeval tv;
gettimeofday (&tv, NULL);
return ((uint64_t) tv.tv_sec) * 1000 + ((uint64_t) tv.tv_usec) / 1000;
return ((double) tv.tv_sec) * 1000.0 + ((double) tv.tv_usec) / 1000.0;
} /* jerry_port_get_current_time */