Build fix
Fix build error on darwin and build with default libc. JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -33,6 +33,8 @@
|
|||||||
#define BUILTIN_UNDERSCORED_ID date
|
#define BUILTIN_UNDERSCORED_ID date
|
||||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
/** \addtogroup ecma ECMA
|
/** \addtogroup ecma ECMA
|
||||||
* @{
|
* @{
|
||||||
*
|
*
|
||||||
@@ -449,7 +451,7 @@ ecma_builtin_date_utc (ecma_value_t this_arg __attr_unused___, /**< this argumen
|
|||||||
static ecma_value_t
|
static ecma_value_t
|
||||||
ecma_builtin_date_now (ecma_value_t this_arg __attr_unused___) /**< this argument */
|
ecma_builtin_date_now (ecma_value_t this_arg __attr_unused___) /**< this argument */
|
||||||
{
|
{
|
||||||
struct _timeval tv;
|
struct timeval tv;
|
||||||
ecma_number_t *now_num_p = ecma_alloc_number ();
|
ecma_number_t *now_num_p = ecma_alloc_number ();
|
||||||
*now_num_p = ECMA_NUMBER_ZERO;
|
*now_num_p = ECMA_NUMBER_ZERO;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,16 @@
|
|||||||
|
|
||||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
|
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
|
||||||
|
|
||||||
#include <time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timezone structure
|
||||||
|
*/
|
||||||
|
struct timezone
|
||||||
|
{
|
||||||
|
int tz_minuteswest; /**< minutes west of Greenwich */
|
||||||
|
int tz_dsttime; /**< type of DST correction */
|
||||||
|
};
|
||||||
|
|
||||||
/** \addtogroup ecma ECMA
|
/** \addtogroup ecma ECMA
|
||||||
* @{
|
* @{
|
||||||
@@ -447,9 +456,10 @@ ecma_date_week_day (ecma_number_t time) /**< time value */
|
|||||||
ecma_number_t __attr_always_inline___
|
ecma_number_t __attr_always_inline___
|
||||||
ecma_date_local_tza ()
|
ecma_date_local_tza ()
|
||||||
{
|
{
|
||||||
|
struct timeval tv;
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
|
|
||||||
if (gettimeofday (NULL, &tz) != 0)
|
if (gettimeofday (&tv, &tz) != 0)
|
||||||
{
|
{
|
||||||
return ecma_raise_type_error ("gettimeofday failed");
|
return ecma_raise_type_error ("gettimeofday failed");
|
||||||
}
|
}
|
||||||
@@ -473,9 +483,10 @@ ecma_date_daylight_saving_ta (ecma_number_t time) /**< time value */
|
|||||||
return time; /* time is NaN */
|
return time; /* time is NaN */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct timeval tv;
|
||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
|
|
||||||
if (gettimeofday (NULL, &tz) != 0)
|
if (gettimeofday (&tv, &tz) != 0)
|
||||||
{
|
{
|
||||||
return ecma_raise_type_error ("gettimeofday failed");
|
return ecma_raise_type_error ("gettimeofday failed");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,21 +25,12 @@ extern "C"
|
|||||||
/**
|
/**
|
||||||
* Time value structure
|
* Time value structure
|
||||||
*/
|
*/
|
||||||
struct _timeval
|
struct timeval
|
||||||
{
|
{
|
||||||
unsigned long tv_sec; /**< seconds */
|
unsigned long tv_sec; /**< seconds */
|
||||||
unsigned long tv_usec; /**< microseconds */
|
unsigned long tv_usec; /**< microseconds */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Timezone structure
|
|
||||||
*/
|
|
||||||
struct timezone
|
|
||||||
{
|
|
||||||
int tz_minuteswest; /**< minutes west of Greenwich */
|
|
||||||
int tz_dsttime; /**< type of DST correction */
|
|
||||||
};
|
|
||||||
|
|
||||||
int gettimeofday (void *tp, void *tzp);
|
int gettimeofday (void *tp, void *tzp);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -25,10 +25,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "jerry-libc-defs.h"
|
#include "jerry-libc-defs.h"
|
||||||
|
|
||||||
@@ -394,5 +393,5 @@ int
|
|||||||
gettimeofday (void *tp, /**< struct timeval */
|
gettimeofday (void *tp, /**< struct timeval */
|
||||||
void *tzp) /**< struct timezone */
|
void *tzp) /**< struct timezone */
|
||||||
{
|
{
|
||||||
return (int) syscall_2 (__NR_gettimeofday, (long int) tp, (long int) tzp);
|
return (int) syscall_2 (gettimeofday, (long int) tp, (long int) tzp);
|
||||||
} /* gettimeofday */
|
} /* gettimeofday */
|
||||||
|
|||||||
@@ -25,10 +25,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <syscall.h>
|
#include <syscall.h>
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "jerry-libc-defs.h"
|
#include "jerry-libc-defs.h"
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "jerry-libc-defs.h"
|
#include "jerry-libc-defs.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user