I want to know on when was the last time the system was started.
Environment.TickCount will work but it is breaking after 48-49 days because of the limitation of int
I think it's just the way they have implemented it.
It goes from 0 to max and then goes from min to 0.
https://msdn.microsoft.com/en-us/library/system.environment.tickcount(v=vs.110).aspx
I have edited the code you are using from http://www.codeproject.com/Articles/13384/Getting-the-user-idle-time-with-C
Why don't you just get the Absolute number?
Public Shared Function GetIdle() As UInteger
Dim lii As New LASTINPUTINFO()
lii.cbSize = Convert.ToUInt32((Marshal.SizeOf(lii)))
GetLastInputInfo(lii)
Dim totalTicks As Long = 0
If Environment.TickCount > 0 Then
totalTicks = Convert.ToUInt64(Environment.TickCount)
Else
totalTicks = Convert.ToUInt64(Environment.TickCount * -1)
End If
Return Math.Abs(totalTicks - lii.dwTime)
End Function