Task

Write a program that does the following in this order:

 Input an amount of time to sleep in whatever units are most natural for your language (milliseconds, seconds, ticks, etc.). This unit should be noted in comments or in a description.
 Print "Sleeping..."
 Sleep the main thread for the given amount of time.
 Print "Awake!"
 End.


Related task

   Nautical bell


/* NetRexx */
options replace format comments java crossref symbols nobinary
 
runSample(arg)
return
 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method sleep(secs) public static binary
  ms = (secs * 1000).format(null, 0) -- milliseconds, rounded to nearest integer
  say 'Sleeping...'
  do
    Thread.sleep(ms)
  catch ix = InterruptedException
    say 'Sleep interrupted!'
    ix.printStackTrace()
  end
  say 'Awake!'
  return
 
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) public static
  secs = -1
  loop until \secs.datatype('N')
    if secs > 0 then do
      say 'Napping for' secs's'
      say
      sleep(secs)
    end
    say
    say 'How many seconds do you want me to sleep? (enter something non-numeric to terminate)\-'
    parse ask secs .
    say
    end
  say
  say 'Goodbye...'
  say
  return
 