Update the webpage (#2573)

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This commit is contained in:
Zsolt Borbély
2018-10-26 20:14:20 +02:00
committed by Akos Kiss
parent c846c4ab73
commit c2b32a83cd
2 changed files with 39 additions and 34 deletions
+38 -33
View File
@@ -86,27 +86,37 @@ void jerry_port_log (jerry_log_level_t level, const char *fmt, ...);
```c ```c
/** /**
* Jerry time zone structure * Get local time zone adjustment, in milliseconds, for the given timestamp.
*/ * The timestamp can be specified in either UTC or local time, depending on
typedef struct * the value of is_utc. Adding the value returned from this function to
{ * a timestamp in UTC time should result in local time for the current time
int offset; /**< minutes from west */ * zone, and subtracting it from a timestamp in local time should result in
int daylight_saving_time; /**< daylight saving time (1 - DST applies, 0 - not on DST) */ * UTC time.
} jerry_time_zone_t; *
* Ideally, this function should satisfy the stipulations applied to LocalTZA
/** * in section 20.3.1.7 of the ECMAScript version 9.0 spec.
* Get timezone and daylight saving data *
* See Also:
* ECMA-262 v9, 20.3.1.7
* *
* Note: * Note:
* This port function is called by jerry-core when * This port function is called by jerry-core when
* CONFIG_DISABLE_DATE_BUILTIN is _not_ defined. Otherwise this function is * CONFIG_DISABLE_DATE_BUILTIN is _not_ defined. Otherwise this function is
* not used. * not used.
* *
* @param[out] tz_p time zone structure to fill. * @param unix_ms The unix timestamp we want an offset for, given in
* @return true - if success * millisecond precision (could be now, in the future,
* false - otherwise * or in the past). As with all unix timestamps, 0 refers to
* 1970-01-01, a day is exactly 86 400 000 milliseconds, and
* leap seconds cause the same second to occur twice.
* @param is_utc Is the given timestamp in UTC time? If false, it is in local
* time.
*
* @return milliseconds between local time and UTC for the given timestamp,
* if available
*. 0 if not available / we are in UTC.
*/ */
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);
/** /**
* Get system time * Get system time
@@ -204,31 +214,26 @@ jerry_port_log (jerry_log_level_t level, /**< log level */
## Date ## Date
```c ```c
#include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include "jerryscript-port.h" #include "jerryscript-port.h"
/** /**
* Default implementation of jerry_port_get_time_zone. * Default 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, /**< ms since unix epoch */
bool is_utc) /**< is the time above in UTC? */
{ {
struct timeval tv; struct tm tm;
struct timezone tz; time_t now = (time_t) (unix_ms / 1000);
localtime_r (&now, &tm);
/* gettimeofday may not fill tz, so zero-initializing */ if (!is_utc)
tz.tz_minuteswest = 0;
tz.tz_dsttime = 0;
if (gettimeofday (&tv, &tz) != 0)
{ {
return false; now -= tm.tm_gmtoff;
localtime_r (&now, &tm);
} }
return ((double) tm.tm_gmtoff) * 1000;
tz_p->offset = tz.tz_minuteswest; } /* jerry_port_get_local_time_zone_adjustment */
tz_p->daylight_saving_time = tz.tz_dsttime > 0 ? 1 : 0;
return true;
} /* jerry_port_get_time_zone */
/** /**
* Default implementation of jerry_port_get_current_time. * Default implementation of jerry_port_get_current_time.
@@ -262,10 +267,10 @@ static jerry_context_t *current_context_p = NULL;
* Set the current_context_p as the passed pointer. * Set the current_context_p as the passed pointer.
*/ */
void void
jerry_port_default_set_context (jerry_context_t *context_p) /**< points to the created context */ jerry_port_default_set_current_context (jerry_context_t *context_p) /**< points to the created context */
{ {
current_context_p = context_p; current_context_p = context_p;
} /* jerry_port_default_set_context */ } /* jerry_port_default_set_current_context */
/** /**
* Get the current context. * Get the current context.
+1 -1
View File
@@ -63,7 +63,7 @@ jerryx_handler_assert_throw (const jerry_value_t func_obj_val, const jerry_value
- [jerryx_handler_register_global](#jerryx_handler_register_global) - [jerryx_handler_register_global](#jerryx_handler_register_global)
## jerryx_handler_assert_fatal ## jerryx_handler_assert
**Summary** **Summary**