|
init >>-init(atime,message)----------------------------------------->< Sets up an alarm for a future time [atime] . At this time, the alarm object sends the message that [message] , a message object, specifies. (See .) The [atime] can a String, DateTime object, or TimeSpan object. If [atime] is a DateTime object, the DateTime specifies a time when the alarm will be triggered. The DateTime must be greater than the current time. If [atime] is a TimeSpan, the Alarm will be set to the current time plus the TimeSpan. The TimeSpan must not be a negative interval. If
[atime]
is a String,
you can specify
this as a date and time ( The following code sets up an alarm at 5:10 p.m. on December 15, 2007. (Assume today's date/time is prior to December 15, 2007.) Class ALARM
/* Alarm Examples */
PersonalMessage=.MyMessageClass~new("Call the Bank")
msg=.message~new(PersonalMessage,"RemindMe")
time = .DateTime~fromIsoDate("2007-12-15T17:10:00.000000")
a=.alarm~new(time, msg)
exit
::class MyMessageClass public
::method init
expose inmsg
use arg inmsg
::method RemindMe
expose inmsg
say "It is now" "TIME"("C")".Please "inmsg
/* On the specified data and time, displays the following message: */
/* "It is now 5:10pm. Please Call the Bank" */
For the following example, the user uses the same code as in the
preceding example to define Class ALARM a=.alarm~new(30,msg) |