ReactOS 0.4.15-dev-7931-gfd331f1
uptime.c File Reference
#include <stdio.h>
#include <windows.h>
#include <tchar.h>
Include dependency graph for uptime.c:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 

Functions

int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 1 of file uptime.c.

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Definition at line 6 of file uptime.c.

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}
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
#define _tprintf
Definition: tchar.h:506
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
WORD wHour
Definition: winbase.h:909
WORD wMinute
Definition: winbase.h:910
int64_t LONGLONG
Definition: typedefs.h:68
LONGLONG QuadPart
Definition: typedefs.h:114
#define _T(x)
Definition: vfdio.h:22