Thanks PhyrePhoX: works OK.
See the get_time statement used in a similar uBasic snippet:
@title Timestamp test
@param p Log (0=No, 1=Yes)
@default p 1
rem main
gosub "date"
if p = 0 then
gosub "closefile"
else
gosub "openfile"
endif
if e<10 then
print "log_";"0";i;".txt"
else
print "log_";i;".txt"
endif
n = 0
shoot
gosub "time"
cls
n = n + 1
gosub "printit"
sleep 5000
shoot
gosub "time"
cls
n = n + 1
gosub "printit"
gosub "closefile"
end
:date
rem f=YYYY, e=MM, d=DD
f = get_time(5)
e = get_time(4)
d = get_time(3)
i = e * 100 + d
return
:time
rem h=hh, m=mm, s=ss
h = get_time(2)
m = get_time(1)
s = get_time(0)
return
:printit
rem some zero prefixing for readability...
if e<10 and d>9 and s<10 then
print "No ";n;": ";f;"-0";e;"-";d;"-";h;":";m;":";"0";s
endif
if e<10 and d>9 and s>9 then
print "No ";n;": ";f;"-0";e;"-";d;"-";h;":";m;":";s
endif
if e<10 and d<10 and s<10 then
print "No ";n;": ";f;"-0";e;"-0";d;"-";h;":";m;":";"0";s
endif
if e<10 and d<10 and s>9 then
print "No ";n;": ";f;"-0";e;"-0";d;"-";h;":";m;":";s
endif
if e>9 and d<10 and s<10 then
print "No ";n;": ";f;"-";e;"-0";d;"-";h;":";m;":";"0";s
endif
if e>9 and d<10 and s>9 then
print "No ";n;": ";f;"-";e;"-0";d;"-";h;":";m;":";s
endif
if e>9 and d>9 and s<10 then
print "No ";n;": ";f;"-";e;"-";d;"-";h;":";m;":";"0";s
endif
if e>9 and d>9 and s>9 then
print "No ";n;": ";f;"-";e;"-";d;"-";h;":";m;":";s
endif
return
:openfile
print_screen i
return
:closefile
print_screen 0
return