11/*
2- * Copyright (c) 2020, 2022 NVI, Inc.
2+ * Copyright (c) 2020, 2022, 2023 NVI, Inc.
33 *
44 * This file is part of VLBI Field System
55 * (see http://github.com/nvi-inc/fs).
@@ -43,16 +43,19 @@ mout6()
4343{
4444 int i ;
4545 struct rdbe_tsys_cycle local [MAX_RDBE ];
46+ struct rdbe_tsys_cycle1 local1 [MAX_RDBE ];
4647 char outflt [12 ];
4748 int tone , chan ;
4849 int iping [4 ];
4950 int it [6 ];
51+ int int_seconds ;
5052 time_t seconds ;
5153 int dot2pps ;
5254 struct tm * tm ;
5355 int inv_vdif [4 ],vdif_should ,inv_pps ;
5456 int inv_dot [4 ];
55- char dot_should [14 ];
57+ char dot_should [MAX_RDBE ][14 ];
58+ char dot_display [18 ];
5659
5760 for (i = 0 ;i < MAX_RDBE ;i ++ ) {
5861 inv_vdif [i ]= 0 ;
@@ -71,32 +74,22 @@ mout6()
7174 memcpy (& local [i ],
7275 & fs -> rdbe_tsys_data [i ].data [iping [i ]],
7376 sizeof (struct rdbe_tsys_cycle ));
77+
78+ memcpy (& local1 [i ],
79+ & fs -> rdbe_tsys_data1 [i ].data [iping [i ]],
80+ sizeof (struct rdbe_tsys_cycle1 ));
7481 }
7582
7683 rte_time (it ,it + 5 );
77- rte2secs (it ,& seconds );
84+ rte2secs (it ,& int_seconds );
85+ seconds = int_seconds ;
7886 tm = gmtime (& seconds );
7987
8088 vdif_should = -1 ;
81- memset (dot_should ,0 ,sizeof (dot_should ));
8289 if (tm -> tm_year > 99 ) {
8390 vdif_should = (tm -> tm_year - 100 )%32 ;
8491 vdif_should = vdif_should * 2 + tm -> tm_mon /6 ;
85- snprintf (dot_should ,sizeof (dot_should ),"%04d%03d%02d%02d%02d" ,
86- tm -> tm_year + 1900 ,
87- tm -> tm_yday + 1 ,
88- tm -> tm_hour ,
89- tm -> tm_min ,
90- tm -> tm_sec );
91- }
92-
93- for (i = 0 ;i < MAX_RDBE ;i ++ ) {
94- inv_dot [i ]= 0 ;
95- if (0 != fs -> rdbe_active [i ] && (iping [i ]== 0 || iping [i ]== 1 ) &&
96- memcmp (local [i ].epoch ,dot_should ,13 ))
97- inv_dot [i ]= 1 ;
9892 }
99-
10093 if (vdif_should >=0 ) {
10194 int valid [MAX_RDBE ],same [MAX_RDBE ];
10295 int active = 0 ;
@@ -117,7 +110,7 @@ mout6()
117110 }
118111
119112 max = 0 ;
120- imax == -1 ;
113+ imax = -1 ;
121114 for (i = 0 ;i < MAX_RDBE ;i ++ ) /* find the one with the most the same */
122115 if (same [i ]> max ) {
123116 max = same [i ];
@@ -135,6 +128,16 @@ mout6()
135128 inv_vdif [j ]= 1 ;
136129 }
137130
131+ for (i = 0 ;i < MAX_RDBE ;i ++ ) {
132+ tm = gmtime (& local1 [i ].arrival );
133+ strftime (dot_should [i ],sizeof (dot_should [i ]),"%Y%j%H%M%S" ,tm );
134+
135+ inv_dot [i ]= 0 ;
136+ if (0 != fs -> rdbe_active [i ] && (iping [i ]== 0 || iping [i ]== 1 ) &&
137+ memcmp (local [i ].epoch ,dot_should [i ],13 ))
138+ inv_dot [i ]= 1 ;
139+ }
140+
138141 for (i = 0 ;i < MAX_RDBE ;i ++ ) {
139142 if (0 == fs -> rdbe_active [i ])
140143 continue ;
@@ -146,12 +149,14 @@ mout6()
146149 standout ();
147150
148151 move (ROW_A + i ,COL_DOT );
149- printw ("%.4s.%.3s.%.2s:%.2s:%.2s" ,
150- local [i ].epoch ,
151- local [i ].epoch + 4 ,
152- local [i ].epoch + 7 ,
153- local [i ].epoch + 9 ,
154- local [i ].epoch + 11 );
152+ local [i ].epoch [13 ]= 0 ;
153+ it [0 ]= it [1 ]= it [2 ]= it [3 ]= it [4 ]= it [5 ]= 0 ;
154+ sscanf (local [i ].epoch ,"%4d%3d%2d%2d%2d" ,it + 5 ,it + 4 ,it + 3 ,it + 2 ,it + 1 );
155+ rte2secs (it ,& int_seconds );
156+ seconds = int_seconds + 1 ;
157+ tm = gmtime (& seconds );
158+ strftime (dot_display ,sizeof (dot_display ),"%Y.%j.%H:%M:%S" , tm );
159+ printw ("%17s" ,dot_display );
155160 if (inv_dot [i ])
156161 standend ();
157162
0 commit comments