ad_page_contract_filter_proc_time24 (public)

 ad_page_contract_filter_proc_time24 name time_varname

Defined in packages/acs-tcl/tcl/tcl-documentation-procs.tcl

Validates time type variables of the 24HR variety (that is 20:12:21)

Parameters:
name
time_varname
Author:
Yonatan Feldman <yon@arsdigita.com>
Created:
25 July 2000

Partial Call Graph (max 5 caller/called nodes):
%3 _ _ (public) ad_complain ad_complain (public) ad_page_contract_filter_proc_time24 ad_page_contract_filter_proc_time24 ad_page_contract_filter_proc_time24->_ ad_page_contract_filter_proc_time24->ad_complain

Testcases:
No testcase defined.
Source code:
upvar $time_varname time

    if { ![info exists time(time)] } {
        ad_complain [_ acs-tcl.lt_Invalid_time_time_is_]
        return 0
    }

    # check if all elements are blank
    if { "$time(time)" eq "" } {
        return 1
    }

    set time_element_values [split $time(time) ":"]
    if { [llength $time_element_values] != 3 } {
        ad_complain [_ acs-tcl.lt_Invalid_time_timetime]
        return 0
    }

    set time_element_names [list hours minutes seconds]

    for { set i 0 } { $i < 3 } { incr i } {
        array set time [list [lindex $time_element_names $i] [lindex $time_element_values $i]]
    }

    if {
        "" eq $time(hours)
        || "" eq $time(minutes)
        || "" eq $time(seconds)
        || $time(hours) < 0 || $time(hours) > 23
        || $time(minutes) < 0 || $time(minutes) > 59
        || $time(seconds) < 0 || $time(seconds) > 59
    } {
        ad_complain [_ acs-tcl.lt_Invalid_time_timetime_2]
        return 0
    }

    return 1
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: