Skip to content

Commit 72b5d7f

Browse files
committed
Change type of current time in port API
Unsigned long int is not necessarily enough as it can be 32 bits only. Changed to uint64_t. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
1 parent 9ce2473 commit 72b5d7f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

jerry-core/jerry-port.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
#ifndef JERRY_PORT_H
1818
#define JERRY_PORT_H
1919

20-
#include <stdio.h>
2120
#include <stdbool.h>
21+
#include <stdint.h>
22+
#include <stdio.h>
2223

2324
#ifdef __cplusplus
2425
extern "C"
@@ -98,7 +99,7 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p);
9899
*
99100
* @return milliseconds since Unix epoch
100101
*/
101-
unsigned long int jerry_port_get_current_time (void);
102+
uint64_t jerry_port_get_current_time (void);
102103

103104
/**
104105
* @}

targets/default/jerry-port-default-date.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
4343
/**
4444
* Default implementation of jerry_port_get_current_time.
4545
*/
46-
unsigned long int jerry_port_get_current_time ()
46+
uint64_t jerry_port_get_current_time ()
4747
{
4848
struct timeval tv;
4949

5050
gettimeofday (&tv, NULL);
5151

52-
return ((unsigned long int) tv.tv_sec) * 1000ul + ((unsigned long int) tv.tv_usec) / 1000ul;
52+
return ((uint64_t) tv.tv_sec) * 1000 + ((uint64_t) tv.tv_usec) / 1000;
5353
} /* jerry_port_get_current_time */

0 commit comments

Comments
 (0)