Finished getting JerryScript on all the platforms.

This commit is contained in:
2026-04-28 13:59:46 -05:00
parent 73e7d6c7f3
commit bd4200e707
15 changed files with 210 additions and 10 deletions
+2 -1
View File
@@ -19,4 +19,5 @@ add_subdirectory(asset)
add_subdirectory(input)
add_subdirectory(log)
add_subdirectory(network)
add_subdirectory(system)
add_subdirectory(system)
add_subdirectory(time)
+9
View File
@@ -0,0 +1,9 @@
# Copyright (c) 2026 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
target_sources(${DUSK_LIBRARY_TARGET_NAME}
PUBLIC
timepsp.c
)
+15
View File
@@ -0,0 +1,15 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "time/timesdl2.h"
#include "time/timepsp.h"
#define timeTickPlatform timeTickSDL2
#define timeGetDeltaPlatform timeGetDeltaSDL2
#define timeGetRealPlatform timeGetRealPSP
#define timeGetRealTimeZonePlatform timeGetRealTimeZonePSP
+40
View File
@@ -0,0 +1,40 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "time/timepsp.h"
#include <time.h>
#include <psptypes.h>
#include <psprtc.h>
double_t timeGetRealPSP(void) {
u64 utc_ticks = 0;
if(sceRtcGetCurrentTick(&utc_ticks) < 0) return 0.0;
/*
PSP RTC ticks are microseconds.
Return seconds since 1970-01-01 UTC.
*/
return (double_t)utc_ticks / 1000000.0;
}
double_t timeGetRealTimeZonePSP(void) {
u64 utc_ticks = 0;
u64 local_ticks = 0;
if(sceRtcGetCurrentTick(&utc_ticks) < 0) return 0.0;
if(sceRtcConvertUtcToLocalTime(&utc_ticks, &local_ticks) < 0) return 0.0;
/*
Return timezone offset in hours.
Example:
UTC-6 => -6.0
UTC+2 => 2.0
*/
int64_t offset_us = (int64_t)local_ticks - (int64_t)utc_ticks;
return (double_t)offset_us / (1000000.0 * 60.0 * 60.0);
}
+23
View File
@@ -0,0 +1,23 @@
/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "dusk.h"
/**
* Returns the real current time, in seconds since January 1, 1970.
*
* @return The real current time, in seconds since January 1, 1970.
*/
double_t timeGetRealPSP(void);
/**
* Returns the real time zone offset in seconds from UTC.
*
* @return The real time zone offset in seconds from UTC.
*/
double_t timeGetRealTimeZonePSP(void);