Replace vera++ with clang-format (#4518)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
This commit is contained in:
Robert Fancsik
2021-11-05 14:15:47 +01:00
committed by GitHub
parent bc091e1742
commit badfdf4dba
564 changed files with 10195 additions and 15090 deletions
+16 -11
View File
@@ -17,30 +17,33 @@
#ifdef _WIN32
#include <windows.h>
#include <winbase.h>
#include <winnt.h>
#endif /* _WIN32 */
#if defined (__GNUC__) || defined (__clang__)
#if defined(__GNUC__) || defined(__clang__)
#include <sys/time.h>
#endif /* __GNUC__ || __clang__ */
#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
#include "jerryscript-port.h"
#ifdef _WIN32
static const LONGLONG UnixEpochInTicks = 116444736000000000; /* difference between 1970 and 1601 */
static const LONGLONG TicksPerMs = 10000; /* 1 tick is 100 nanoseconds */
/* https://support.microsoft.com/en-us/help/167296/how-to-convert-a-unix-time-t-to-a-win32-filetime-or-systemtime */
static void UnixTimeMsToFileTime (double t, LPFILETIME pft)
static void
UnixTimeMsToFileTime (double t, LPFILETIME pft)
{
LONGLONG ll = (LONGLONG) t * TicksPerMs + UnixEpochInTicks;
pft->dwLowDateTime = (DWORD) ll;
pft->dwHighDateTime = (DWORD) (ll >> 32);
} /* UnixTimeMsToFileTime */
static double FileTimeToUnixTimeMs (FILETIME ft)
static double
FileTimeToUnixTimeMs (FILETIME ft)
{
ULARGE_INTEGER date;
date.HighPart = ft.dwHighDateTime;
@@ -56,10 +59,11 @@ static double FileTimeToUnixTimeMs (FILETIME ft)
* @return offset between UTC and local time at the given unix timestamp, if
* available. Otherwise, returns 0, assuming UTC time.
*/
double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since unix epoch */
bool is_utc) /**< is the time above in UTC? */
double
jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since unix epoch */
bool is_utc) /**< is the time above in UTC? */
{
#if defined (HAVE_TM_GMTOFF)
#if defined(HAVE_TM_GMTOFF)
struct tm tm;
time_t now = (time_t) (unix_ms / 1000);
localtime_r (&now, &tm);
@@ -71,7 +75,7 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since
}
return ((double) tm.tm_gmtoff) * 1000;
#elif defined (_WIN32)
#elif defined(_WIN32)
FILETIME fileTime, localFileTime;
SYSTEMTIME systemTime, localSystemTime;
ULARGE_INTEGER time, localTime;
@@ -95,7 +99,7 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since
return (double) (((LONGLONG) localTime.QuadPart - (LONGLONG) time.QuadPart) / TicksPerMs);
}
return 0.0;
#elif defined (__GNUC__) || defined (__clang__)
#elif defined(__GNUC__) || defined(__clang__)
time_t now_time = (time_t) (unix_ms / 1000);
double tza_s = 0.0;
@@ -138,13 +142,14 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since
* executed successfully,
* 0 - otherwise.
*/
double jerry_port_get_current_time (void)
double
jerry_port_get_current_time (void)
{
#ifdef _WIN32
FILETIME ft;
GetSystemTimeAsFileTime (&ft);
return FileTimeToUnixTimeMs (ft);
#elif defined (__GNUC__) || defined (__clang__)
#elif defined(__GNUC__) || defined(__clang__)
struct timeval tv;
if (gettimeofday (&tv, NULL) == 0)