Author: gedmurphy
Date: Fri Aug 25 04:33:27 2006
New Revision: 23696
URL:
http://svn.reactos.org/svn/reactos?rev=23696&view=rev
Log:
add an 'uptime' command.
Available in either Windows or Linux output. (defaulted to Windows)
Added:
trunk/reactos/base/applications/cmdutils/uptime/
trunk/reactos/base/applications/cmdutils/uptime/uptime.c
trunk/reactos/base/applications/cmdutils/uptime/uptime.rbuild
trunk/reactos/base/applications/cmdutils/uptime/uptime.rc
Modified:
trunk/reactos/base/applications/cmdutils/cmdutils.rbuild
Modified: trunk/reactos/base/applications/cmdutils/cmdutils.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/cmdutils.rbuild (original)
+++ trunk/reactos/base/applications/cmdutils/cmdutils.rbuild Fri Aug 25 04:33:27 2006
@@ -5,4 +5,7 @@
<directory name="more">
<xi:include href="more/more.rbuild" />
</directory>
+<directory name="uptime">
+ <xi:include href="uptime/uptime.rbuild" />
+</directory>
</group>
Added: trunk/reactos/base/applications/cmdutils/uptime/uptime.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/uptime/uptime.c (added)
+++ trunk/reactos/base/applications/cmdutils/uptime/uptime.c Fri Aug 25 04:33:27 2006
@@ -1,0 +1,34 @@
+#define WIN32_LEAN_AND_MEAN
+#include <stdio.h>
+#include <windows.h>
+#include <tchar.h>
+
+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;
+}
Added: trunk/reactos/base/applications/cmdutils/uptime/uptime.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/uptime/uptime.rbuild (added)
+++ trunk/reactos/base/applications/cmdutils/uptime/uptime.rbuild Fri Aug 25 04:33:27
2006
@@ -1,0 +1,9 @@
+<module name="uptime" type="win32cui"
installbase="system32" installname="uptime.exe">
+ <define name="__USE_W32API" />
+ <define name="_WIN32_IE">0x0501</define>
+ <define name="_WIN32_WINNT">0x0501</define>
+<!-- <define name="LINUX_OUTPUT"></define> -->
+ <library>kernel32</library>
+ <file>uptime.c</file>
+ <file>uptime.rc</file>
+</module>
Added: trunk/reactos/base/applications/cmdutils/uptime/uptime.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils…
==============================================================================
--- trunk/reactos/base/applications/cmdutils/uptime/uptime.rc (added)
+++ trunk/reactos/base/applications/cmdutils/uptime/uptime.rc Fri Aug 25 04:33:27 2006
@@ -1,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 <reactos/version.rc>