Showing 3 changed files with 18 additions and 15 deletions
+13 -11
Nasal/display.nas
... ...
@@ -271,19 +271,20 @@ var displayClass = {
271 271
             }, 'Endurance'],
272 272
             ETA: [func {
273 273
                 var eteSeconds = getprop('/autopilot/route-manager/ete');
274
-                var eta_hours = getprop('/sim/time/utc/hour');
274
+                string.scanf(data.time, '%02u:%02u:%02u', var eta = []);
275
+
275 276
                 var eteHours = math.floor(eteSeconds / 3600);
276
-                if (eteHours > 12)
277
+                if (eteHours > 24)
277 278
                     return '--:--';
278
-                var eta_minutes = int((eteSeconds - (eteHours * 3600)) / 60) + getprop('/sim/time/utc/minute');
279
-                if (eta_minutes > 59) {
280
-                    eta_minutes -= 60;
281
-                    eta_hours += 1;
279
+                eta[1] += int((eteSeconds - (eteHours * 3600)) / 60);
280
+                if (eta[1] > 59) {
281
+                    eta[1] -= 60;
282
+                    eta[0] += 1;
282 283
                 }
283
-                eta_hours += eteHours;
284
-                if (eta_hours > 23)
285
-                    eta_hours -= 24;
286
-                return sprintf('%02i:%02i', eta_hours, eta_minutes);
284
+                eta[0] += eteHours;
285
+                if (eta[0] > 23)
286
+                    eta[0] -= 24;
287
+                return sprintf('%02i:%02i', eta[0], eta[1]);
287 288
             }, 'Estimated Time of Arrival'],
288 289
             GS:  [func return sprintf('%3iKT', getprop('/velocities/groundspeed-kt')), 'Ground Speed'],
289 290
             TRK: [func return sprintf('%03i°', getprop('/orientation/track-deg')), 'Track'],
... ...
@@ -1232,10 +1233,11 @@ var displayClass = {
1232 1233
 
1233 1234
     updateTIME : func {
1234 1235
 # updates the displayed time botoom left {{{
1236
+        time[data.settings.time.label]();
1235 1237
         me.screenElements['TIME-REF-text']
1236 1238
             .setText(data.settings.time.label);
1237 1239
         me.screenElements['TIME-text']
1238
-            .setText(time[data.settings.time.label]());
1240
+            .setText(data.time);
1239 1241
     },
1240 1242
 #}}}
1241 1243
 
+4 -4
Nasal/lib.nas
... ...
@@ -42,11 +42,11 @@ var DMS = func (d, c) {
42 42
 
43 43
 var time = {
44 44
     GMT : func {
45
-        return getprop('/sim/time/gmt-string');
45
+        data.time = getprop('/sim/time/gmt-string');
46 46
     },
47 47
 
48 48
     UTC : func {
49
-        return sprintf('%02i:%02i:%02i',
49
+        data.time = sprintf('%02i:%02i:%02i',
50 50
                     getprop('/sim/time/utc/hour'),
51 51
                     getprop('/sim/time/utc/minute'),
52 52
                     getprop('/sim/time/utc/second'));
... ...
@@ -56,14 +56,14 @@ var time = {
56 56
         var utc_hour = getprop('/sim/time/utc/hour') + (getprop('/sim/time/local-offset') / 3600);
57 57
         if (utc_hour > 23) utc_hour -= 24;
58 58
         if (utc_hour < 0)  utc_hour += 24;
59
-        return sprintf('%02i:%02i:%02i',
59
+        data.time = sprintf('%02i:%02i:%02i',
60 60
                     utc_hour,
61 61
                     getprop('/sim/time/utc/minute'),
62 62
                     getprop('/sim/time/utc/second'));
63 63
     },
64 64
 
65 65
     RL : func {
66
-        return sprintf('%02i:%02i:%02i',
66
+        data.time = sprintf('%02i:%02i:%02i',
67 67
                     getprop('/sim/time/real/hour'),
68 68
                     getprop('/sim/time/real/minute'),
69 69
                     getprop('/sim/time/real/second'));
+1
zkv1000.nas
... ...
@@ -37,6 +37,7 @@ var data = { # set of data common to all devices
37 37
     lat : 0,
38 38
     lon : 0,
39 39
     aoa : 0,
40
+    time : '23:59:59',
40 41
     fpSize : 0,
41 42
     tcas: [],
42 43
     tcas_level: 0,