Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jerry-core/ecma/builtin-objects/ecma-builtin-date.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 1 addition & 2 deletions jerry-core/jerry-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#define JERRY_PORT_H

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

#ifdef __cplusplus
Expand Down Expand Up @@ -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);

/**
* @}
Expand Down
4 changes: 2 additions & 2 deletions targets/default/jerry-port-default-date.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */