changeset 624:e7c88d4e917c

tj: Only get clock once.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 11 Feb 2021 10:02:55 +0200
parents efc0e4919746
children 5eca657134a5
files tj.tcl
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tj.tcl	Wed Feb 10 15:27:31 2021 +0200
+++ b/tj.tcl	Thu Feb 11 10:02:55 2021 +0200
@@ -167,8 +167,8 @@
 }
 
 
-proc tj_display_tjs {upublic unick uchan uname uid} {
-  set uclock [clock seconds]
+proc tj_display_tjs {upublic unick uchan uname uid uclock} {
+
   set nresults 0
   set usql "SELECT * FROM tj WHERE uuser='[utl_escape $uname]' AND utype=0 AND uid LIKE '[utl_escape $uid]'"
   tj_dbh eval $usql {
@@ -203,6 +203,7 @@
     return 1
   }
 
+  set uclock [clock seconds]
   set uhand [tj_correct_handle $uhand]
   set qadmin [matchattr $uhand n]
 
@@ -391,7 +392,6 @@
       set uname $uhand
     }
 
-    set uclock [clock seconds]
 
     set usql "SELECT COUNT(*) FROM tj WHERE uuser='[utl_escape $uname]'"
     if {[catch {set nitems [tj_dbh onecolumn $usql]} uerrmsg]} {
@@ -452,7 +452,7 @@
       return 1
     }
 
-    tj_display_tjs $upublic $unick $uchan $uname $uid
+    tj_display_tjs $upublic $unick $uchan $uname $uid $uclock
   } else {
     # !tj [#<id>] [name]
     set uname $uhand
@@ -472,7 +472,7 @@
       set uid $tj_default_id
     }
 
-    tj_display_tjs $upublic $unick $uchan $uname $uid
+    tj_display_tjs $upublic $unick $uchan $uname $uid $uclock
   }
 
   return 1