Change jerry_port interface to allow for a correct implementation of timezones. (#2540)
The previous jerry_port interface did not allow timezones to be handled correctly, even if the host system was up to the task. This PR changes the jerry_port interface to allow a completely correct implementation to exist, and provides one (for Linux/BSD systems) in default-date.c. Fixes #1661 JerryScript-DCO-1.0-Signed-off-by: crazy2be crazy1be@gmail.com
This commit is contained in:
@@ -52,16 +52,13 @@ void jerry_port_fatal (jerry_fatal_code_t code)
|
||||
} /* jerry_port_fatal */
|
||||
|
||||
/**
|
||||
* Curie BSP implementation of jerry_port_get_time_zone.
|
||||
* Curie BSP implementation of jerry_port_get_local_time_zone_adjustment.
|
||||
*/
|
||||
bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
|
||||
double jerry_port_get_local_time_zone_adjustment (double unix_ms, bool is_utc)
|
||||
{
|
||||
//EMPTY implementation
|
||||
tz_p->offset = 0;
|
||||
tz_p->daylight_saving_time = 0;
|
||||
|
||||
return true;
|
||||
} /* jerry_port_get_time_zone */
|
||||
return 0;
|
||||
} /* jerry_port_get_local_time_zone_adjustment */
|
||||
|
||||
/**
|
||||
* Curie BSP implementation of jerry_port_get_current_time.
|
||||
|
||||
@@ -61,16 +61,13 @@ jerry_port_get_current_time (void)
|
||||
} /* jerry_port_get_current_time */
|
||||
|
||||
/**
|
||||
* Dummy function to get the time zone.
|
||||
* Dummy function to get the time zone adjustment.
|
||||
*
|
||||
* @return true
|
||||
* @return 0
|
||||
*/
|
||||
bool
|
||||
jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
|
||||
double
|
||||
jerry_port_get_local_time_zone_adjustment (double unix_ms, bool is_utc)
|
||||
{
|
||||
/* We live in UTC. */
|
||||
tz_p->offset = 0;
|
||||
tz_p->daylight_saving_time = 0;
|
||||
|
||||
return true;
|
||||
} /* jerry_port_get_time_zone */
|
||||
return 0;
|
||||
} /* jerry_port_get_local_time_zone_adjustment */
|
||||
|
||||
@@ -46,17 +46,15 @@ jerry_port_log (jerry_log_level_t level, /**< log level */
|
||||
#endif /* JSMBED_OVERRIDE_JERRY_PORT_LOG */
|
||||
|
||||
/**
|
||||
* Implementation of jerry_port_get_time_zone.
|
||||
* Implementation of jerry_port_get_local_time_zone_adjustment.
|
||||
*
|
||||
* @return true - if success
|
||||
* @return 0, as we live in UTC.
|
||||
*/
|
||||
bool
|
||||
jerry_port_get_time_zone (jerry_time_zone_t *tz_p) /**< timezone pointer */
|
||||
double
|
||||
jerry_port_get_local_time_zone_adjustment (double unix_ms, bool is_utc)
|
||||
{
|
||||
tz_p->offset = 0;
|
||||
tz_p->daylight_saving_time = 0;
|
||||
return true;
|
||||
} /* jerry_port_get_time_zone */
|
||||
return 0;
|
||||
} /* jerry_port_get_local_time_zone_adjustment */
|
||||
|
||||
/**
|
||||
* Implementation of jerry_port_get_current_time.
|
||||
|
||||
@@ -492,19 +492,16 @@ jerry_port_log (jerry_log_level_t level, /**< log level */
|
||||
} /* jerry_port_log */
|
||||
|
||||
/**
|
||||
* Dummy function to get the time zone.
|
||||
* Dummy function to get the time zone adjustment.
|
||||
*
|
||||
* @return true
|
||||
* @return 0
|
||||
*/
|
||||
bool
|
||||
jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
|
||||
double
|
||||
jerry_port_get_local_time_zone_adjustment (double unix_ms, bool is_utc)
|
||||
{
|
||||
/* We live in UTC. */
|
||||
tz_p->offset = 0;
|
||||
tz_p->daylight_saving_time = 0;
|
||||
|
||||
return true;
|
||||
} /* jerry_port_get_time_zone */
|
||||
return 0;
|
||||
} /* jerry_port_get_local_time_zone_adjustment */
|
||||
|
||||
/**
|
||||
* Dummy function to get the current time.
|
||||
|
||||
@@ -474,19 +474,16 @@ jerry_port_log (jerry_log_level_t level, /**< log level */
|
||||
} /* jerry_port_log */
|
||||
|
||||
/**
|
||||
* Dummy function to get the time zone.
|
||||
* Dummy function to get the time zone adjustment.
|
||||
*
|
||||
* @return true
|
||||
* @return 0
|
||||
*/
|
||||
bool
|
||||
jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
|
||||
double
|
||||
jerry_port_get_local_time_zone_adjustment (double unix_ms, bool is_utc)
|
||||
{
|
||||
/* We live in UTC. */
|
||||
tz_p->offset = 0;
|
||||
tz_p->daylight_saving_time = 0;
|
||||
|
||||
return true;
|
||||
} /* jerry_port_get_time_zone */
|
||||
return 0;
|
||||
} /* jerry_port_get_local_time_zone_adjustment */
|
||||
|
||||
/**
|
||||
* Dummy function to get the current time.
|
||||
|
||||
@@ -59,19 +59,16 @@ jerry_port_get_current_time (void)
|
||||
} /* jerry_port_get_current_time */
|
||||
|
||||
/**
|
||||
* Dummy function to get the time zone.
|
||||
* Dummy function to get the time zone adjustment.
|
||||
*
|
||||
* @return true
|
||||
* @return 0
|
||||
*/
|
||||
bool
|
||||
jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
|
||||
double
|
||||
jerry_port_get_local_time_zone_adjustment (double unix_ms, bool is_utc)
|
||||
{
|
||||
/* We live in UTC. */
|
||||
tz_p->offset = 0;
|
||||
tz_p->daylight_saving_time = 0;
|
||||
|
||||
return true;
|
||||
} /* jerry_port_get_time_zone */
|
||||
return 0;
|
||||
} /* jerry_port_get_local_time_zone_adjustment */
|
||||
|
||||
/**
|
||||
* Provide the implementation of jerryx_port_handler_print_char.
|
||||
|
||||
Reference in New Issue
Block a user