diff --git a/sys-botbase/source/commands.c b/sys-botbase/source/commands.c index 257509a..9104991 100644 --- a/sys-botbase/source/commands.c +++ b/sys-botbase/source/commands.c @@ -6,7 +6,6 @@ #include #include "commands.h" #include "util.h" -#include "time.h" //Controller: bool bControllerIsInitialised = false; @@ -525,3 +524,15 @@ void sendUsbResponse(USBResponse response) if (response.size > 0) usbCommsWrite(response.data, response.size); } + +long getUnixTime() +{ + time_t unixTime = 0; + Result tg = timeGetCurrentTime(TimeType_UserSystemClock, (u64*)&unixTime); + if (R_FAILED(tg)) + { + fatalThrow(tg); + return -1; + } + return unixTime; +} diff --git a/sys-botbase/source/commands.h b/sys-botbase/source/commands.h index 7789d21..f70247b 100644 --- a/sys-botbase/source/commands.h +++ b/sys-botbase/source/commands.h @@ -71,4 +71,5 @@ void key(HiddbgKeyboardAutoPilotState* states, u64 sequentialCount); void clickSequence(char* seq, u8* token); void dateSkip(); void resetTime(); +long getUnixTime(); void sendUsbResponse(USBResponse response); diff --git a/sys-botbase/source/main.c b/sys-botbase/source/main.c index 3ffccaa..d142522 100644 --- a/sys-botbase/source/main.c +++ b/sys-botbase/source/main.c @@ -944,6 +944,18 @@ int argmain(int argc, char **argv) if(!strcmp(argv[0], "resetTime")) resetTime(); + + if (!strcmp(argv[0], "getUnixTime")) + { + long time = getUnixTime(); + if (usb) + { + response.size = sizeof(long); + response.data = &time; + sendUsbResponse(response); + } + else printf("%016lX\n", time); + } return 0; }