nstcl  >  Documentation  >  nstcl-time  >  duration

Tcl Powered!

duration

NAME

duration — Calculates the number of seconds of a given time period

SYNOPSIS

package require nstcl-time ?1.0.1?
package require nstcl ?1.0?

::nstcl::duration ?-nocomplain? ?-absolute_value? ?-default default? period

DESCRIPTION

This function returns the number of seconds of a given period of time. For example, duration "1 day" would return 86400. period can be in any format understood by [clock scan].

OPTIONAL SWITCHES

-absolute_value
If this switch is present, and the duration is a negative number (for example, duration "1 hour ago"), the absolute value will be returned instead.
-default (defaults to 0)
This switch specifies what value should be returned if period cannot be parsed, and the -nocomplain option was used.
-nocomplain
If this switch is specified, and period cannot be parsed by [clock scan], then rather than generating an error, the value given to the -default switch will be used.

KEYWORDS

nstcl, time