Date and Time Math for Local Notifications

I’ve been trying to set a local notification to go off at certain times on future dates and have been getting very inconsistent results with the timing of the alert.

The last approach I tried is below:

local t = os.date( '\*t' ) -- get table of current date and time local futureTime = ((24+18) \* 3600) -(t.hour \*3600) - (t.min\*60)-t.sec --6pm tomorrow local options = { alert = "It's Six PM!", badge = 0, sound = "alarm.caf", custom = { msg = "Alarm" }} system.scheduleNotification( futureTime, options )

This alert endend up going off at 11:42am rather than 6pm. Any suggestions as to what I am doing wrong or should do?

Thanks for your help.