template::util::date::now_min_interval (public)

 template::util::date::now_min_interval [ -clock clock ]

Defined in packages/acs-templating/tcl/date-procs.tcl

Create a new Date object for the current date and time with the default interval for minutes

Switches:
-clock (optional)
time in seconds, if not specified, it uses current time
Author:
Walter McGinnis <wtem@olywa.net>
Created:
2002-01-06

Partial Call Graph (max 5 caller/called nodes):
%3 test_date_minute_interval date_minute_interval (test acs-templating) template::util::date::now_min_interval template::util::date::now_min_interval test_date_minute_interval->template::util::date::now_min_interval template::util::date::create template::util::date::create (public) template::util::date::now_min_interval->template::util::date::create template::util::date::defaultInterval template::util::date::defaultInterval (public) template::util::date::now_min_interval->template::util::date::defaultInterval util::trim_leading_zeros util::trim_leading_zeros (public) template::util::date::now_min_interval->util::trim_leading_zeros

Testcases:
date_minute_interval
Source code:
    if {$clock eq ""} {
        set clock  [clock seconds]
    }

    set now [list]
    foreach v [clock format $clock -format "%Y %m %d %H %M %S"] {
        lappend now [util::trim_leading_zeros $v]
    }
    #
    # Get original minute value
    #
    set minute [lindex $now 4]

    #
    # Get interval definition for "minute" (e.g. 0 59 5)
    #
    lassign [defaultInterval minutes] min max interval

    for { set i $min } { $i <= $max } { incr i $interval } {
        if {$minute == $i} {
            break
        } elseif {$minute < $i} {
            set minute $i
            break
        }
    }
    #
    # Replace the minute value in the now list with new value
    #
    lset now 4 $minute

    return [create {*}$now]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: