fix sub-seconds in time formats
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
|
||||
# ca* by Dirk Zimoch
|
||||
# $Source: /cvs/G/EPICS/App/scripts/ca,v $
|
||||
# $Date: 2016/10/04 12:07:47 $
|
||||
# $Date: 2017/02/06 08:09:41 $
|
||||
|
||||
regsub -all {\$} {ca* by Dirk Zimoch
|
||||
$Source: /cvs/G/EPICS/App/scripts/ca,v $
|
||||
$Revision: 1.34 $
|
||||
$Date: 2016/10/04 12:07:47 $} {} version
|
||||
$Revision: 1.35 $
|
||||
$Date: 2017/02/06 08:09:41 $} {} version
|
||||
|
||||
package require Tclx
|
||||
package require Epics
|
||||
@@ -119,7 +119,6 @@ proc bgerror {msg} {
|
||||
|
||||
proc formatval {channel {value {}} {sevr {}} {stat {}} {time {}}} {
|
||||
global info flags prec tfmt ltfmt
|
||||
set clock [clock seconds]
|
||||
set EGU ""
|
||||
foreach {attr val} $info($channel) {
|
||||
set $attr $val
|
||||
@@ -222,27 +221,28 @@ proc formatval {channel {value {}} {sevr {}} {stat {}} {time {}}} {
|
||||
set status ""
|
||||
}
|
||||
}
|
||||
if {[scan $time "%d/%d/%d %d:%d:%d.%d" m d y H M S N] != 7} {
|
||||
if {[scan $time "%d/%d/%d %d:%d:%f" m d y H M S] != 6} {
|
||||
set m 0
|
||||
set d 0
|
||||
set y 0
|
||||
set H 0
|
||||
set M 0
|
||||
set S 0
|
||||
set N 000000000
|
||||
}
|
||||
set time ""
|
||||
set microseconds [clock microseconds]
|
||||
set seconds [expr $microseconds/1000000]
|
||||
foreach flag $flags {
|
||||
switch -- $flag {
|
||||
"-d" -
|
||||
"-date" {append time [format " %02d.%02d.%02d" $d $m $y]}
|
||||
"-localdate" {append time [clock format $clock -format " %d.%m.%y"]}
|
||||
"-localdate" {append time [clock format $seconds -format " %d.%m.%y"]}
|
||||
"-t" -
|
||||
"-time" {append time [format " %02d:%02d:%02d.%.2s" $H $M $S $N]}
|
||||
"-localtime" {append time [clock format $clock -format " %H:%M:%S"]}
|
||||
"-timestamp" {append time " [clock scan "$m/$d/$y $H:$M:$S"].$N"}
|
||||
"-tfmt" {append time [clock format [clock scan "$m/$d/$y $H:$M:$S"] -format [regsub -all {%N} " $tfmt" $N]]}
|
||||
"-ltfmt" {append time [clock format $clock -format [regsub -all {%N} " $tfmt" "000000000"]]}
|
||||
"-time" {append time [format " %02d:%02d:%05.6f" $H $M $S]}
|
||||
"-localtime" {append time [clock format $seconds -format " %H:%M:%S."] [string range $microseconds end-5 end]}
|
||||
"-timestamp" {append time [format " %s" [expr [clock scan "$m/$d/$y $H:$M"]+$S]]}
|
||||
"-tfmt" {append time [clock format [clock scan "$m/$d/$y $H:$M:[expr int($S)]"] -format [regsub -all "%N" " $tfmt" [format "%09d" [expr int(($S-int($S))*1e9)]]]]}
|
||||
"-ltfmt" {append time [clock format $seconds -format [regsub -all "%N" " $ltfmt" [string range $microseconds end-5 end]000]]}
|
||||
"-noname" {set channel ""}
|
||||
"-nounit" {set EGU ""}
|
||||
"-nostat" {set status ""}
|
||||
|
||||
Reference in New Issue
Block a user