Author: Fernando Silva How to get Windows uptime? Answer: Use the following function: 1 function UpTime: string; 2 const 3 ticksperday: integer = 1000 * 60 * 60 * 24; 4 ticksperhour: integer = 1000 * 60 * 60; 5 ticksperminute: integer = 1000 * 60; 6 tickspersecond: integer = 1000; 7 8 var 9 t: longword; 10 d, h, m, s: integer; 11 12 begin 13 t := GetTickCount; 14 15 d := t div ticksperday; 16 dec(t, d * ticksperday); 17 18 h := t div ticksperhour; 19 dec(t, h * ticksperhour); 20 21 m := t div ticksperminute; 22 dec(t, m * ticksperminute); 23 24 s := t div tickspersecond; 25 26 Result := 'Uptime: ' + IntToStr(d) + ' Days ' + IntToStr(h) + ' Hours ' + 27 IntToStr(m) 28 + ' Minutes ' + IntToStr(s) + ' Seconds'; 29 end;