Do you think you could atleast try to explain what you try to achieve, and how your results differ from that?
Also, what would "typl" typically be? What could it be?
Right now I can't make heads and tails about what it is you are asking help with... You're just posting fragments that really does'nt make much sense by their own...
If you are asking for help on constructing a valid sql-query, we'd need help on which dialect of sql you're using (mysql, postgresql, mssql, etc), the actual layout of your database and so forth...
What I can say, atleast for mysql, is that it is advisable to supply a column-list with INSERT-queries (although not required).
If you just want something to work, you'd be better off posting under "Script Requests".
$typl is not a table.. it's a variable.. If the value is retrieved from a sql-database using a query, say so.
That said, most time/date formats used by various sql-dialects can be directly interpreted using "clock scan". The date in your first post works just fine with "clock scan" (tested with: clock format [clock scan "2007-05-03 12:35:25"]). If you are using some different date/time-format, please specify it.'
Also, you say it should respond if the time delta is less than 300, yet your test in the conditional is wether it is actually greater or equal than 300...
returned a value of 732398 for me, which is quite larger than 300, and hence the conditional would be true, and whatever code you have within your if-statement would be executed.
Try setting maxtime to something alittle smaller, that won't overflow. Such as 2000000...
In any case, have you tried printing the actual value that you're comparing: ie putlog "$typl : [expr [unixtime] - [clock scan $typl]]", so that you can see what is actually going on?