Eskil

Check-in [38b105b675]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Error estimate in file age
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 38b105b67548603b8dab6abd304c819d56cfb190
User & Date: peter 2015-02-26 01:19:22.648
Context
2015-03-01
21:34
Get correct mode when reading from VFS. Handle delta artifact in Fossil. check-in: d7211de04e user: peter tags: trunk
2015-02-26
01:19
Error estimate in file age check-in: 38b105b675 user: peter tags: trunk
01:17
Error estimate in file age check-in: f86812b766 user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vcsvfs.tcl.
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
            set col1 [string trim [lindex $cols 1]]
            set col2 [string trim [lindex $cols 3]]
            # First column is age, in readable format
            # e.g. "current" "36.4 minutes" "97.0 days" "1.06 years"
            if {$col1 eq ""} continue
            if {$col1 eq "current"} {
                set fTime $commitTime
                set errX 0
            } else {
                set value [lindex $col1 0]
                set unit [lindex $col1 1]
                set errX 0
                switch -glob $unit {
                    second* {
                        set value [expr {int($value)}]
                        set unit second
                        set errX 0
                    }
                    minute* {
                        # In general, try to underestimate the value. The web
                        # page rounds to one decimal.
                        set value [expr {int(($value-0.05)*60)}]
                        set unit second
                        set errX 6
                    }
                    hour* {
                        set value [expr {int(($value-0.05)*60*60)}]
                        set unit second
                        set errX 360
                    }
                    day* {
                        set value [expr {int(($value-0.05)*60*60*24)}]
                        set unit second
                        set errX 8640
                    }
                    year* {
                        # Year has two decimals
                        set value [expr {int(($value-0.005)*60*60*24*365)}]
                        set unit second
                        set errX [expr {6*60*24*365}]
                    }
                    default {
                        puts "Unhandled unit: $unit in '$col1'"
                        set value [expr {int($value)}]
                    }
                }
                set fTime [expr {$commitTime - $value}]







|



|




|






|




|




|





|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
            set col1 [string trim [lindex $cols 1]]
            set col2 [string trim [lindex $cols 3]]
            # First column is age, in readable format
            # e.g. "current" "36.4 minutes" "97.0 days" "1.06 years"
            if {$col1 eq ""} continue
            if {$col1 eq "current"} {
                set fTime $commitTime
                set err 0
            } else {
                set value [lindex $col1 0]
                set unit [lindex $col1 1]
                set err 0
                switch -glob $unit {
                    second* {
                        set value [expr {int($value)}]
                        set unit second
                        set err 0
                    }
                    minute* {
                        # In general, try to underestimate the value. The web
                        # page rounds to one decimal.
                        set value [expr {int(($value-0.05)*60)}]
                        set unit second
                        set err 6
                    }
                    hour* {
                        set value [expr {int(($value-0.05)*60*60)}]
                        set unit second
                        set err 360
                    }
                    day* {
                        set value [expr {int(($value-0.05)*60*60*24)}]
                        set unit second
                        set err 8640
                    }
                    year* {
                        # Year has two decimals
                        set value [expr {int(($value-0.005)*60*60*24*365)}]
                        set unit second
                        set err [expr {6*60*24*365}]
                    }
                    default {
                        puts "Unhandled unit: $unit in '$col1'"
                        set value [expr {int($value)}]
                    }
                }
                set fTime [expr {$commitTime - $value}]
157
158
159
160
161
162
163

164
165
166
167
168
169
170
171
            regsub -all {\n} $col2 "" col2
            regsub -all {<br>} $col2 "\n" col2
            set col2 [string trim $col2]
            foreach fName [split $col2 \n] {
                # Check that it matches something filled in from the artifact
                if {[dict exists $finfo $fName]} {
                    dict set finfo $fName mtime $fTime

                    dict set finfo $fName errX $errX
                }
            }
        }
        # Kill surrounding while loop
        break
    }








>
|







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
            regsub -all {\n} $col2 "" col2
            regsub -all {<br>} $col2 "\n" col2
            set col2 [string trim $col2]
            foreach fName [split $col2 \n] {
                # Check that it matches something filled in from the artifact
                if {[dict exists $finfo $fName]} {
                    dict set finfo $fName mtime $fTime
                    # Store error estimate for debug help
                    dict set finfo $fName errX $err
                }
            }
        }
        # Kill surrounding while loop
        break
    }