fixed formatting

This commit is contained in:
CPunch 2023-06-01 22:28:07 -05:00
parent 10c9f92a06
commit 861607d6a8
3 changed files with 39 additions and 41 deletions

View File

@ -3,57 +3,54 @@
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> # include <time.h>
#include <time.h> # include <windows.h>
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) # if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 116444736000000000Ui64 # define DELTA_EPOCH_IN_MICROSECS 116444736000000000Ui64
#else # else
#define DELTA_EPOCH_IN_MICROSECS 116444736000000000ULL # define DELTA_EPOCH_IN_MICROSECS 116444736000000000ULL
#endif # endif
struct timezone struct timezone
{ {
int tz_minuteswest; /* minutes W of Greenwich */ int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */ int tz_dsttime; /* type of dst correction */
}; };
int gettimeofday(struct timeval *tv, struct timezone *tz) int gettimeofday(struct timeval *tv, struct timezone *tz)
{ {
FILETIME ft; FILETIME ft;
unsigned __int64 tmpres = 0; unsigned __int64 tmpres = 0;
static int tzflag; static int tzflag;
if (NULL != tv) if (NULL != tv) {
{ GetSystemTimeAsFileTime(&ft);
GetSystemTimeAsFileTime(&ft);
tmpres |= ft.dwHighDateTime; tmpres |= ft.dwHighDateTime;
tmpres <<= 32; tmpres <<= 32;
tmpres |= ft.dwLowDateTime; tmpres |= ft.dwLowDateTime;
/*converting file time to unix epoch*/ /*converting file time to unix epoch*/
tmpres /= 10; /*convert into microseconds*/ tmpres /= 10; /*convert into microseconds*/
tmpres -= DELTA_EPOCH_IN_MICROSECS; tmpres -= DELTA_EPOCH_IN_MICROSECS;
tv->tv_sec = (long)(tmpres / 1000000UL); tv->tv_sec = (long)(tmpres / 1000000UL);
tv->tv_usec = (long)(tmpres % 1000000UL); tv->tv_usec = (long)(tmpres % 1000000UL);
}
if (NULL != tz)
{
if (!tzflag)
{
_tzset();
tzflag++;
} }
tz->tz_minuteswest = _timezone / 60;
tz->tz_dsttime = _daylight;
}
return 0; if (NULL != tz) {
if (!tzflag) {
_tzset();
tzflag++;
}
tz->tz_minuteswest = _timezone / 60;
tz->tz_dsttime = _daylight;
}
return 0;
} }
#else #else
#include <sys/time.h> # include <sys/time.h>
#endif #endif
#endif #endif

View File

@ -1,13 +1,13 @@
#include "cbaselib.h" #include "cbaselib.h"
#include "_time.h"
#include "cdebug.h"
#include "cmem.h" #include "cmem.h"
#include "cobj.h" #include "cobj.h"
#include "cvalue.h" #include "cvalue.h"
#include "cdebug.h"
#include "cvm.h" #include "cvm.h"
#include <math.h> #include <math.h>
#include "_time.h"
// ================================================================ [BASELIB] // ================================================================ [BASELIB]
@ -891,7 +891,8 @@ int cosmoB_vdisassemble(CState *state, int nargs, CValue *args)
closure = cosmoV_readClosure(args[0]); closure = cosmoV_readClosure(args[0]);
// print the disasembly // print the disasembly
disasmChunk(&closure->function->chunk, closure->function->name ? closure->function->name->str : UNNAMEDCHUNK, 0); disasmChunk(&closure->function->chunk,
closure->function->name ? closure->function->name->str : UNNAMEDCHUNK, 0);
return 0; return 0;
} }

View File

@ -42,9 +42,9 @@ COSMO_API bool cosmoV_undump(CState *state, cosmo_Reader reader, const void *ud)
return false; return false;
}; };
#ifdef VM_DEBUG // #ifdef VM_DEBUG
disasmChunk(&func->chunk, func->name ? func->name->str : UNNAMEDCHUNK, 0); disasmChunk(&func->chunk, func->name ? func->name->str : UNNAMEDCHUNK, 0);
#endif // #endif
// push function onto the stack so it doesn't it cleaned up by the GC, at the same stack // push function onto the stack so it doesn't it cleaned up by the GC, at the same stack
// location put our closure // location put our closure