... | ... |
@@ -110,30 +110,8 @@ var knobsClass = { |
110 | 110 |
elsif (time >= 180) # 3 minutes |
111 | 111 |
d *= 10; |
112 | 112 |
|
113 |
- ss += d; |
|
113 |
+ val = HMS(hh, mm, ss, d); |
|
114 | 114 |
|
115 |
- if (ss > 59) { |
|
116 |
- ss -= 60; |
|
117 |
- mm += 1; |
|
118 |
- if (mm > 59) { |
|
119 |
- mm = 0; |
|
120 |
- hh += 1; |
|
121 |
- } |
|
122 |
- } |
|
123 |
- elsif (ss < 0) { |
|
124 |
- if (mm > 0) { |
|
125 |
- ss += 60; |
|
126 |
- mm -= 1; |
|
127 |
- } |
|
128 |
- elsif (mm == 0 and hh > 0) { |
|
129 |
- ss += 60; |
|
130 |
- mm = 59; |
|
131 |
- hh -= 1; |
|
132 |
- } |
|
133 |
- elsif (mm == 0 and hh == 0) |
|
134 |
- ss = 0; |
|
135 |
- } |
|
136 |
- val = sprintf('%02i:%02i:%02i', hh, mm, ss); |
|
137 | 115 |
me.device.windows.window[me.device.windows.selected] |
138 | 116 |
.setText(val); |
139 | 117 |
object.text = val; |
... | ... |
@@ -90,6 +90,34 @@ var timeRL = func { |
90 | 90 |
getprop('/sim/time/real/second'))); |
91 | 91 |
} |
92 | 92 |
|
93 |
+# returns time + d (is seconds) formated HH:MM:SS |
|
94 |
+var HMS = func (hh, mm, ss, d = 0) { |
|
95 |
+ ss += d; |
|
96 |
+ |
|
97 |
+ if (ss > 59) { |
|
98 |
+ ss -= 60; |
|
99 |
+ mm += 1; |
|
100 |
+ if (mm > 59) { |
|
101 |
+ mm = 0; |
|
102 |
+ hh += 1; |
|
103 |
+ } |
|
104 |
+ } |
|
105 |
+ elsif (ss < 0) { |
|
106 |
+ if (mm > 0) { |
|
107 |
+ ss += 60; |
|
108 |
+ mm -= 1; |
|
109 |
+ } |
|
110 |
+ elsif (mm == 0 and hh > 0) { |
|
111 |
+ ss += 60; |
|
112 |
+ mm = 59; |
|
113 |
+ hh -= 1; |
|
114 |
+ } |
|
115 |
+ elsif (mm == 0 and hh == 0) |
|
116 |
+ ss = 0; |
|
117 |
+ } |
|
118 |
+ return sprintf('%02i:%02i:%02i', hh, mm, ss); |
|
119 |
+} |
|
120 |
+ |
|
93 | 121 |
### |
94 | 122 |
# Loads a fligtplan (route) from a XML file |
95 | 123 |
# replaces existing route by the new one |