diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2023-01-17 20:44:10 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2023-01-17 20:44:10 -0500 |
commit | 509858a44aedffebbbca37909c065ec0e4c5d2b5 (patch) | |
tree | 388f0af65f89cab378cf2e0e4e293dd485c33f07 /src/lpm.c | |
parent | 02fea1ede8878fb2fa7b4708e11ef28b0b375152 (diff) | |
download | lite-xl-plugin-manager-509858a44aedffebbbca37909c065ec0e4c5d2b5.tar.gz lite-xl-plugin-manager-509858a44aedffebbbca37909c065ec0e4c5d2b5.zip |
Added list of core dependencies so we don't generate manifest rqeuirements for them.
Diffstat (limited to 'src/lpm.c')
-rw-r--r-- | src/lpm.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -977,6 +977,20 @@ int lpm_flock(lua_State* L) { return 0; } +int lpm_time(lua_State* L) { + #if _WIN32 // Fuck I hate windows jesus chrsit. + LARGE_INTEGER LoggedTime, Freqency; + QueryPerformanceFrequency(&Frequency); + QueryPerformanceCounter(&LoggedTime); + lua_pushnumber(L, LoggedTime.QuadPart / (double)Frequency.QuadPart); + #else + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + lua_pushnumber(L, ts.tv_sec + ts.tv_nsec * 100000000.0); + #endif + return 1; +} + static const luaL_Reg system_lib[] = { { "ls", lpm_ls }, // Returns an array of files. { "stat", lpm_stat }, // Returns info about a single file. @@ -996,6 +1010,7 @@ static const luaL_Reg system_lib[] = { { "chdir", lpm_chdir }, // Changes directory. Only use for --post actions. { "pwd", lpm_pwd }, // Gets existing directory. Only use for --post actions. { "flock", lpm_flock }, // Locks a file. + { "time", lpm_time }, // Get high-precision system time. { NULL, NULL } }; |