
proc ladd {var args} {
	upvar $var v
	foreach val $args {
		if {$val ni $v} { lappend v $val }
	}
}

proc lremove {var val} {
	upvar $var v
	if {$val ni $v} return
	set v [lsearch -all -inline -not -exact $v $val]
}

# Returns the epoch time for midnight today, accounting for local timezone
proc midnight {} {{today ""}} {
	if {$today eq ""} {
		set today [clock format [clock seconds] -format "%Y %m %d"]
	}
	return [clock scan "$today 00:00:00" -format "%Y %m %d %T"]
}

