ReactOS  0.4.13-dev-443-g10f00f8
uptime.c
Go to the documentation of this file.
1 #define WIN32_LEAN_AND_MEAN
2 #include <stdio.h>
3 #include <windows.h>
4 #include <tchar.h>
5 
6 int main(int argc, char* argv[])
7 {
8  SYSTEMTIME SystemTime;
9  LARGE_INTEGER liCount, liFreq;
10 
11  GetLocalTime(&SystemTime);
12 
13  if (QueryPerformanceCounter(&liCount) &&
15  {
16  LONGLONG TotalSecs = liCount.QuadPart / liFreq.QuadPart;
17  LONGLONG Days = (TotalSecs / 86400);
18  LONGLONG Hours = ((TotalSecs % 86400) / 3600);
19  LONGLONG Mins = ((TotalSecs % 86400) % 3600) / 60;
20  LONGLONG Secs = ((TotalSecs % 86400) % 3600) % 60;
21 
22 #ifdef LINUX_OUTPUT
24  _tprintf(_T(" %.2u:%.2u "), SystemTime.wHour, SystemTime.wMinute);
25  _tprintf(_T("up %I64u days, %I64u:%I64u\n"), Days, Hours, Mins); /*%.2I64u secs*/
26 #else
27  _tprintf(_T("System Up Time:\t\t%I64u days, %I64u Hours, %I64u Minutes, %.2I64u Seconds\n"),
28  Days, Hours, Mins, Secs);
29 #endif
30  return 0;
31  }
32 
33  return -1;
34 }
static int argc
Definition: ServiceArgs.c:12
#define _tprintf
Definition: tchar.h:506
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define argv
Definition: mplay32.c:18
WORD wMinute
Definition: winbase.h:875
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
int main(int argc, char *argv[])
Definition: uptime.c:6
int64_t LONGLONG
Definition: typedefs.h:66
#define _T(x)
Definition: vfdio.h:22
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
WORD wHour
Definition: winbase.h:874
LONGLONG QuadPart
Definition: typedefs.h:112