From 7adefa623281858ddb2ad8832ecdf4565b05c54e Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Fri, 25 Aug 2006 10:11:57 +0000 Subject: [PATCH] move uptime to rosapps so Alex doesn't blow up into teeny weeny pieces ;) svn path=/trunk/; revision=23702 --- rosapps/cmdutils/uptime/uptime.c | 34 +++++++++++++++++++++++++++ rosapps/cmdutils/uptime/uptime.rbuild | 9 +++++++ rosapps/cmdutils/uptime/uptime.rc | 4 ++++ 3 files changed, 47 insertions(+) create mode 100644 rosapps/cmdutils/uptime/uptime.c create mode 100644 rosapps/cmdutils/uptime/uptime.rbuild create mode 100644 rosapps/cmdutils/uptime/uptime.rc diff --git a/rosapps/cmdutils/uptime/uptime.c b/rosapps/cmdutils/uptime/uptime.c new file mode 100644 index 00000000000..2ad49b13c35 --- /dev/null +++ b/rosapps/cmdutils/uptime/uptime.c @@ -0,0 +1,34 @@ +#define WIN32_LEAN_AND_MEAN +#include +#include +#include + +int main(int argc, char* argv[]) +{ + SYSTEMTIME SystemTime; + LARGE_INTEGER liCount, liFreq; + + GetLocalTime(&SystemTime); + + if (QueryPerformanceCounter(&liCount) && + QueryPerformanceFrequency(&liFreq)) + { + LONGLONG TotalSecs = liCount.QuadPart / liFreq.QuadPart; + LONGLONG Days = (TotalSecs / 86400); + LONGLONG Hours = ((TotalSecs % 86400) / 3600); + LONGLONG Mins = ((TotalSecs % 86400) % 3600) / 60; + LONGLONG Secs = ((TotalSecs % 86400) % 3600) % 60; + +#ifdef LINUX_OUTPUT + UNREFERENCED_PARAMETER(Secs); + _tprintf(_T(" %.2u:%.2u "), SystemTime.wHour, SystemTime.wMinute); + _tprintf(_T("up %I64u days, %I64u:%I64u\n"), Days, Hours, Mins); /*%.2I64u secs*/ +#else + _tprintf(_T("System Up Time:\t\t%I64u days, %I64u Hours, %I64u Minutes, %.2I64u Seconds\n"), + Days, Hours, Mins, Secs); +#endif + return 0; + } + + return -1; +} diff --git a/rosapps/cmdutils/uptime/uptime.rbuild b/rosapps/cmdutils/uptime/uptime.rbuild new file mode 100644 index 00000000000..563edfbb97e --- /dev/null +++ b/rosapps/cmdutils/uptime/uptime.rbuild @@ -0,0 +1,9 @@ + + + 0x0501 + 0x0501 + + kernel32 + uptime.c + uptime.rc + diff --git a/rosapps/cmdutils/uptime/uptime.rc b/rosapps/cmdutils/uptime/uptime.rc new file mode 100644 index 00000000000..1da139422b3 --- /dev/null +++ b/rosapps/cmdutils/uptime/uptime.rc @@ -0,0 +1,4 @@ +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS uptime\0" +#define REACTOS_STR_INTERNAL_NAME "uptime\0" +#define REACTOS_STR_ORIGINAL_FILENAME "uptime.exe\0" +#include