Wapp

Forum
Login

clock format in static compiled wapptclsh?

By mteege on 2018-11-16 08:07:09

I have a small project where I can use wapp. I've compiled wapptclsh and then tried to execute the following programm:

#!/usr/bin/env wapptclsh                                                                                                                  
package require wapp

proc wapp-default {} {
  wapp-trim {
    [clock format [clock seconds] -format %Y-%m-%d]
  }                                                                                                                                       
}                                                                                                                                         
wapp-start $argv

That fails with:

invalid command name "::tcl::clock::format"
    while executing
"clock format [clock seconds] -format %Y-%m-%d"
    invoked from within
"subst -novariables {[clock format [clock seconds] -format %Y-%m-%d]}"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 [list subst -novariables $txt]"
    (procedure "wapp-trim" line 5)
    invoked from within
"wapp-trim {
    [clock format [clock seconds] -format %Y-%m-%d]
  }"                                                                                                                                      
    (procedure "wapp-default" line 2)
    invoked from within
"wapp-default"

It looks like the clock::format command is not available in the static Tcl interpreter. I think I can use the date and time functions from sqlite3 but that "feels" wrong.

Is it possible to make this function available? Is there a better way to make the date calculations?

Matthias