uCon HomePage

Script Cmd: TIME


TIME [-ef:qrs] [hires-on | hires-off]

Print the current time of day or compute elapsed time in milliseconds. With no options, a HH:MM:SS time string is printed.

Options:

-e           print elapsed time since last stamp
-f {format}  print formatted time/date string (see below).
-q           quiet mode (TIME variable is updated, but all console output is turned off).
-r           display best-case-achievable timer resolution in milliseconds
-s           stamp the current time.

Subcommands (see notes 2&3 below):

hires-on:          enable uCon's use of a higher resolution system timer (more CPU intense)
hires-off:          disable the use of the higher resolution system timer (more efficient, but less accurate)
 

Format...

EXAMPLE1:

# display 01/26/06 10:25:05
TIME -f\%c
# display Started on Thursday January 26, 2006 at 10:27:26
TIME -f "Started on \%A \%B \%d, \%Y at \%I:\%M:\%S"

EXAMPLE2:

This script will do "something" at the top of every hour...

# TOP:
TIME -qf %M
set LASTTIME $TIME
# Every 10 seconds wake up and see if the minute has changed.
# If it has, then see if it changed to 0. If it has, then we
# assume we've just passed the top of the hour...
#
# LOOP:
SLEEP 10000
TIME -qf %M
if $TIME ne $LASTTIME goto NEW_MINUTE
goto LOOP
# NEW_MINUTE:
set LASTTIME $TIME
echo New minute: $TIME
if $TIME eq 0 goto TOP_OF_THE_HOUR
goto LOOP
# TOP_OF_THE_HOUR:
echo HEY, its the top of the hour!!!
goto LOOP

* Note_1: this command will populate the shell variable "TIME" with the result.

* Note_2: uCon's script runner supports symbols (refer to scripting overview), which are similar to shell variables but are preceded by a '%' instead of a '$'. So, since '%' is used as a delimiter in the format script, if SYMFILE is set (meaning that symbols are being used) the '%' sign should be preceded by a backslash so that uCon knows not to parse this as a symbol name. Refer to the SYMBOLS section of the SCRIPT help text for more info on symbols.