The task is to make a daily break in a timereport, when entering a new day, the time should be save for the old and a new event should be started for the next day.
This could be done when the user checks out; check if it started on a previous day and then register yesterday as an event and then create and save a new event for the day he checked out.
But I think (for closing each day correct, there might be need for running a report early in the day and the user might not have ended his shift yet) that I would try to have a service running at midnight and close the day before and start a new event.
What is the best way to set the service to start at midnight every day?
I have this code in Service_Start but are not sure that it will set 24 hours until next start. The date will probably be the same day...
Should I add 1 to the date or should I set "00:00:00"?
Can I always be sure that this Service will be called at exactly 23:59:59 every day without delays?
Are there better ways to run a service at an exact time?
This could be done when the user checks out; check if it started on a previous day and then register yesterday as an event and then create and save a new event for the day he checked out.
But I think (for closing each day correct, there might be need for running a report early in the day and the user might not have ended his shift yet) that I would try to have a service running at midnight and close the day before and start a new event.
What is the best way to set the service to start at midnight every day?
I have this code in Service_Start but are not sure that it will set 24 hours until next start. The date will probably be the same day...
Should I add 1 to the date or should I set "00:00:00"?
Can I always be sure that this Service will be called at exactly 23:59:59 every day without delays?
Are there better ways to run a service at an exact time?
B4X:
Dim lTime As Long
Dim start, endTime As Long
start = DateTime.now
endTime = DateTime.DateTimeParse(DateTime.date(DateTime.Now), "23:59:59")
lTime = Abs(endTime - start)
StartServiceAt("Midnight",lTime, True)