I have simple console appllication Which logs user Log-in, log-out,lock-unlock timings day by day and shows total time on desk
My application captures timestamps day by day and stores them in file. there is file for each day
I want to schedule a task which capture time before 12 o'clock (Midnight).
There could be scenario in which user logged in
1. logged in @9:00AM in the mornig so First Logged time = 9:00AM 12-March-2014
2. Locked his @6:00PM in the evening so Last Logged time = 6:00Pm
3. User again logged in @ 10:00Pm so Last Logged time = 10:00Pm Here we have total logged time is 13Hrs (Last-First)
4. Now user locked his mahine @2:00 AM 13-March-2014. as User logged in @ 10:00Pm that time is logged in log file but user was still working till next day 2:00AM, application missed 2Hours.
To to avoid this sitution I want to create sceduled task which will run in case
1. User is logged in
2.If machine is on i.e. user is working