-
Notifications
You must be signed in to change notification settings - Fork 207
/
Copy pathtime_UT.c
2544 lines (2211 loc) · 101 KB
/
time_UT.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
** GSC-18128-1, "Core Flight Executive Version 6.7"
**
** Copyright (c) 2006-2019 United States Government as represented by
** the Administrator of the National Aeronautics and Space Administration.
** All Rights Reserved.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*
** File:
** time_UT.c
**
** Purpose:
** Time Services unit test
**
** References:
** 1. cFE Application Developers Guide
** 2. unit test standard 092503
** 3. C Coding Standard 102904
**
** Notes:
** 1. This is unit test code only, not for use in flight
**
*/
/*
** Includes
*/
#include "time_UT.h"
/*
** External global variables
*/
const char *TIME_SYSLOG_MSGS[] = {NULL, "%s: Error reading cmd pipe,RC=0x%08X\n",
"%s: Application Init Failed,RC=0x%08X\n", "%s: 1Hz OS_TimerAdd failed:RC=0x%08X\n",
"%s: 1Hz OS_TimerSet failed:RC=0x%08X\n"};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_SEND_HK = {.MsgId =
CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_HK_MID)};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_TONE_CMD = {.MsgId =
CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_TONE_CMD_MID)};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_DATA_CMD = {.MsgId =
CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_DATA_CMD_MID)};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_1HZ_CMD = {.MsgId =
CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_1HZ_CMD_MID)};
#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_SEND_CMD = {.MsgId =
CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_SEND_CMD_MID)};
#endif
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_NOOP_CC = {.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID),
.CommandCode = CFE_TIME_NOOP_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_RESET_COUNTERS_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_RESET_COUNTERS_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SEND_DIAGNOSTIC_TLM_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SEND_DIAGNOSTIC_TLM_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_STATE_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_STATE_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_SOURCE_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_SOURCE_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_SIGNAL_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_SIGNAL_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_DELAY_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_ADD_DELAY_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_DELAY_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SUB_DELAY_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_TIME_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_TIME_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_MET_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_MET_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_STCF_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_STCF_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SET_LEAP_SECONDS_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SET_LEAP_SECONDS_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_ADJUST_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_ADD_ADJUST_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_ADJUST_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SUB_ADJUST_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_ADD_1HZ_ADJUSTMENT_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_ADD_1HZ_ADJUSTMENT_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_SUB_1HZ_ADJUSTMENT_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = CFE_TIME_SUB_1HZ_ADJUSTMENT_CC};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_INVALID_MID = {.MsgId = CFE_SB_MSGID_RESERVED, .CommandCode = 0};
static const UT_TaskPipeDispatchId_t UT_TPID_CFE_TIME_CMD_INVALID_CC = {
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_CMD_MID), .CommandCode = 0x7F};
/*
** Global variables
*/
int32 ut_time_CallbackCalled;
/*
** Functions
*/
#if (CFE_PLATFORM_TIME_CFG_SIGNAL == true)
/*****************************************************************************/
/**
** \brief OS_SelectTone stub function
**
** \par Description
** This function is used as a placeholder for the OS API function
** OS_SelectTone.
**
** \par Assumptions, External Events, and Notes:
** None
**
** \returns
** This function does not return a value.
**
******************************************************************************/
void OS_SelectTone(int16 Signal) {}
#endif
/*
* A hook functions for CFE_PSP_GetTime that updates the Reference State.
* This mimmics what would happen if a time update occurred at the moment
* another task was reading the time.
*/
int32 UT_TimeRefUpdateHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context)
{
volatile CFE_TIME_ReferenceState_t *RefState;
uint32 * UpdateCount = UserObj;
uint32 i;
/*
* NOTE: in order to trigger a read retry, this actually needs to do CFE_TIME_REFERENCE_BUF_DEPTH
* updates, such that the buffer being read is overwritten.
*/
if (*UpdateCount > 0)
{
for (i = 0; i < CFE_TIME_REFERENCE_BUF_DEPTH; ++i)
{
RefState = CFE_TIME_StartReferenceUpdate();
RefState->AtToneLatch.Seconds = 1 + CallCount;
RefState->ClockSetState = CFE_TIME_SetState_WAS_SET;
CFE_TIME_FinishReferenceUpdate(RefState);
}
--(*UpdateCount);
}
return StubRetcode;
}
void UtTest_Setup(void)
{
/* Initialize unit test */
UT_Init("time");
UtPrintf("cFE TIME Unit Test Output File\n\n");
UT_ADD_TEST(Test_Main);
UT_ADD_TEST(Test_Init);
UT_ADD_TEST(Test_GetTime);
UT_ADD_TEST(Test_TimeOp);
UT_ADD_TEST(Test_ConvertTime);
UT_ADD_TEST(Test_Print);
UT_ADD_TEST(Test_RegisterSyncCallbackTrue);
UT_ADD_TEST(Test_ExternalTone);
UT_ADD_TEST(Test_External);
UT_ADD_TEST(Test_PipeCmds);
UT_ADD_TEST(Test_ResetArea);
UT_ADD_TEST(Test_State);
UT_ADD_TEST(Test_GetReference);
UT_ADD_TEST(Test_Tone);
UT_ADD_TEST(Test_1Hz);
UT_ADD_TEST(Test_UnregisterSynchCallback);
UT_ADD_TEST(Test_CleanUpApp);
}
/*
** Test task entry point and main process loop
*/
void Test_Main(void)
{
CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID;
UtPrintf("Begin Test Main");
/* Test successful run through (a pipe read error is expected) */
UT_InitData();
/* Set up buffer for first cycle, pipe failure is on 2nd */
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false);
CFE_TIME_TaskMain();
CFE_UtAssert_SYSLOG(TIME_SYSLOG_MSGS[1]);
}
/*
** Test API and time task initialization (must be called prior to
** remaining tests)
*/
void Test_Init(void)
{
int16 ExpRtn;
int16 SubErrCnt = 0;
#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
int16 SubLocalErrCnt = 0;
#endif
UtPrintf("Begin Test Init");
/* Test successful API initialization */
UT_InitData();
ExpRtn = 3;
#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
ExpRtn++;
#endif
#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
#if (CFE_MISSION_TIME_CFG_FAKE_TONE == true)
ExpRtn++;
#endif
#endif
/* account for 1Hz command, which is always enabled */
ExpRtn++;
CFE_TIME_EarlyInit();
UtAssert_STUB_COUNT(CFE_MSG_Init, ExpRtn);
/* Test successful time task initialization */
UT_InitData();
CFE_UtAssert_SUCCESS(CFE_TIME_TaskInit());
/* Test response to a failure creating the first child task */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_ES_CreateChildTask), 1, -1);
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1);
/* Test response to a failure creating the second child task */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_ES_CreateChildTask), 2, -3);
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -3);
/* Test response to an error creating a command pipe */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -1);
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1);
/* Test response to failure of the HK request subscription */
UT_InitData();
SubErrCnt++;
UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt);
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -SubErrCnt);
/* Test response to failure of the tone commands subscription */
UT_InitData();
ExpRtn = 0;
#if (CFE_PLATFORM_TIME_CFG_CLIENT == true)
SubErrCnt++;
UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt);
ExpRtn = -SubErrCnt;
#endif
#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
SubLocalErrCnt++;
UT_SetDeferredRetcode(UT_KEY(CFE_SB_SubscribeLocal), SubLocalErrCnt, -SubLocalErrCnt);
ExpRtn = -SubLocalErrCnt;
#endif
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn);
/* Test response to failure of the time at the tone "data" commands
* subscription
*/
UT_InitData();
ExpRtn = 0;
#if (CFE_PLATFORM_TIME_CFG_CLIENT == true)
SubErrCnt++;
UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt);
ExpRtn = -SubErrCnt;
#endif
#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
SubLocalErrCnt++;
UT_SetDeferredRetcode(UT_KEY(CFE_SB_SubscribeLocal), SubLocalErrCnt, -SubLocalErrCnt);
ExpRtn = -SubLocalErrCnt;
#endif
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn);
/* Test response to failure of the fake tone signal commands
* subscription
*/
UT_InitData();
ExpRtn = 0;
#if (CFE_MISSION_TIME_CFG_FAKE_TONE == true)
#if (CFE_PLATFORM_TIME_CFG_CLIENT == true)
SubErrCnt++;
UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt);
ExpRtn = -SubErrCnt;
#endif
#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
SubLocalErrCnt++;
UT_SetDeferredRetcode(UT_KEY(CFE_SB_SubscribeLocal), SubLocalErrCnt, -SubLocalErrCnt);
ExpRtn = -SubLocalErrCnt;
#endif
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn);
#else
UtAssert_NA("*Not tested* Fake tone signal commands subscription failure");
#endif
/* Test response to failure of the time at tone signal commands
* subscription
*/
UT_InitData();
#if (CFE_PLATFORM_TIME_CFG_SERVER == true && CFE_PLATFORM_TIME_CFG_SOURCE != true && \
CFE_MISSION_TIME_CFG_FAKE_TONE != true)
SubErrCnt++;
UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt);
ExpRtn = -SubErrCnt;
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn);
#else
SubErrCnt++;
UtAssert_NA("*Not tested* Time at tone signal commands subscription failure");
#endif
/* Test response to failure of the time task ground commands
* subscription
*/
UT_InitData();
SubErrCnt++;
UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), SubErrCnt, -SubErrCnt);
ExpRtn = -SubErrCnt;
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), ExpRtn);
/* Test response to failure creating a tone semaphore */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(OS_BinSemCreate), 1, -1);
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1);
/* Test response to failure creating a local semaphore */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(OS_BinSemCreate), 2, -2);
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -2);
/* Test response to an EVS register failure */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -1);
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1);
/* Test response to an error sending an initialization event */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, -1);
UtAssert_INT32_EQ(CFE_TIME_TaskInit(), -1);
/* Test response to a failure to get the ID by name */
UT_InitData();
UT_SetDefaultReturnValue(UT_KEY(OS_TimeBaseGetIdByName), OS_ERROR);
CFE_TIME_TaskInit();
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 0);
/* Test response to an error setting up the 1Hz callback.
* Note that this is only a SysLog message, it does not return the
* error. This allows the overall system to continue without the 1Hz
*/
UT_InitData();
UT_SetDefaultReturnValue(UT_KEY(OS_TimerAdd), OS_ERROR);
CFE_TIME_TaskInit();
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1);
CFE_UtAssert_SYSLOG(TIME_SYSLOG_MSGS[3]);
UT_InitData();
UT_SetDefaultReturnValue(UT_KEY(OS_TimerSet), OS_ERROR);
CFE_TIME_TaskInit();
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1);
CFE_UtAssert_SYSLOG((TIME_SYSLOG_MSGS[4]));
}
/*
** Test functions to retrieve time values
*/
void Test_GetTime(void)
{
unsigned int result;
uint16 StateFlags;
/* Note: Time is in seconds + microseconds since epoch */
unsigned int seconds = 1041472984;
unsigned int microsecs = 567890;
volatile CFE_TIME_ReferenceState_t *RefState;
CFE_TIME_SysTime_t time;
CFE_TIME_SysTime_t expectedMET = {.Seconds = 1041472994, .Subseconds = 2439068978};
CFE_TIME_SysTime_t expectedTAI = {.Seconds = 1041476594, .Subseconds = 2439068978};
CFE_TIME_SysTime_t expectedUTC = {.Seconds = 1041476562, .Subseconds = 2439068978};
CFE_TIME_SysTime_t expectedSTCF = {.Seconds = 3600, .Subseconds = 0};
UtPrintf("Begin Test Get Time");
CFE_TIME_Global.LastVersionCounter = 0x1000;
/* Test successfully retrieving the mission elapsed time */
UT_InitData();
UT_SetBSP_Time(seconds, microsecs);
RefState = CFE_TIME_StartReferenceUpdate();
RefState->AtToneMET.Seconds = 20; /* 20.00000 */
RefState->AtToneMET.Subseconds = 0;
RefState->AtToneSTCF.Seconds = 3600; /* 01:00:00.00000 */
RefState->AtToneSTCF.Subseconds = 0;
RefState->AtToneLeapSeconds = 32;
RefState->AtToneDelay.Seconds = 0; /* 0.00000 */
RefState->AtToneDelay.Subseconds = 0;
RefState->AtToneLatch.Seconds = 10; /* 10.00000 */
RefState->AtToneLatch.Subseconds = 0;
RefState->ClockSetState = CFE_TIME_SetState_NOT_SET; /* Force invalid time */
CFE_TIME_FinishReferenceUpdate(RefState);
time = CFE_TIME_GetMET();
UtAssert_UINT32_EQ(time.Seconds, expectedMET.Seconds);
UtAssert_UINT32_EQ(time.Subseconds, expectedMET.Subseconds);
/* Test successfully retrieving the mission elapsed time (seconds
* portion)
*/
UT_InitData();
UT_SetBSP_Time(seconds, microsecs);
result = seconds + RefState->AtToneMET.Seconds - RefState->AtToneLatch.Seconds;
UtAssert_INT32_EQ(CFE_TIME_GetMETseconds(), result);
/* Test successfully retrieving the mission elapsed time (sub-seconds
* portion)
*/
UT_InitData();
UT_SetBSP_Time(seconds, microsecs);
result = CFE_TIME_Micro2SubSecs(microsecs) + RefState->AtToneMET.Subseconds - RefState->AtToneLatch.Subseconds;
UtAssert_INT32_EQ(CFE_TIME_GetMETsubsecs(), result);
/* Test successfully retrieving the leap seconds */
UT_InitData();
UtAssert_INT32_EQ(CFE_TIME_GetLeapSeconds(), RefState->AtToneLeapSeconds);
/* Test successfully retrieving the international atomic time (TAI) */
UT_InitData();
UT_SetBSP_Time(seconds, microsecs);
time = CFE_TIME_GetTAI();
UtAssert_UINT32_EQ(time.Seconds, expectedTAI.Seconds);
UtAssert_UINT32_EQ(time.Subseconds, expectedTAI.Subseconds);
/* Test successfully retrieving the coordinated universal time (UTC) */
UT_InitData();
UT_SetBSP_Time(seconds, microsecs);
time = CFE_TIME_GetUTC();
UtAssert_UINT32_EQ(time.Seconds, expectedUTC.Seconds);
UtAssert_UINT32_EQ(time.Subseconds, expectedUTC.Subseconds);
/* Test successfully retrieving the default time (UTC or TAI) */
UT_InitData();
UT_SetBSP_Time(seconds, microsecs);
time = CFE_TIME_GetTime();
#if (CFE_MISSION_TIME_CFG_DEFAULT_TAI == true)
UtAssert_UINT32_EQ(time.Seconds, expectedTAI.Seconds);
UtAssert_UINT32_EQ(time.Subseconds, expectedTAI.Subseconds);
#else
UtAssert_UINT32_EQ(time.Seconds, expectedUTC.Seconds);
UtAssert_UINT32_EQ(time.Subseconds, expectedUTC.Subseconds);
#endif
/* Test successfully retrieving the spacecraft time correlation
* factor (SCTF)
*/
UT_InitData();
UT_SetBSP_Time(seconds, microsecs);
time = CFE_TIME_GetSTCF();
UtAssert_UINT32_EQ(time.Seconds, expectedSTCF.Seconds);
UtAssert_UINT32_EQ(time.Subseconds, expectedSTCF.Subseconds);
/* Test retrieving the time status (invalid time is expected) */
UT_InitData();
UtAssert_INT32_EQ(CFE_TIME_GetClockState(), CFE_TIME_ClockState_INVALID);
/* Test alternate flag values */
RefState = CFE_TIME_StartReferenceUpdate();
RefState->ClockSetState = CFE_TIME_SetState_NOT_SET;
RefState->ClockFlyState = CFE_TIME_FlywheelState_NO_FLY;
CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_EXTERNAL;
CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_REDUNDANT;
CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_NO_FLY;
CFE_TIME_Global.Forced2Fly = false;
CFE_TIME_Global.OneTimeDirection = CFE_TIME_AdjustDirection_SUBTRACT;
CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_SUBTRACT;
RefState->DelayDirection = CFE_TIME_AdjustDirection_SUBTRACT;
CFE_TIME_Global.IsToneGood = false;
CFE_TIME_Global.GetReferenceFail = false;
CFE_TIME_FinishReferenceUpdate(RefState);
StateFlags = 0;
#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
StateFlags |= CFE_TIME_FLAG_SERVER;
#endif
UtAssert_UINT32_EQ(CFE_TIME_GetClockInfo(), StateFlags);
/* Test successfully converting the clock state data to flag values */
UT_InitData();
RefState = CFE_TIME_StartReferenceUpdate();
RefState->ClockSetState = CFE_TIME_SetState_WAS_SET;
RefState->ClockFlyState = CFE_TIME_FlywheelState_IS_FLY;
RefState->DelayDirection = CFE_TIME_AdjustDirection_ADD;
CFE_TIME_FinishReferenceUpdate(RefState);
CFE_TIME_Global.ClockSource = CFE_TIME_SourceSelect_INTERNAL;
CFE_TIME_Global.ClockSignal = CFE_TIME_ToneSignalSelect_PRIMARY;
CFE_TIME_Global.ServerFlyState = CFE_TIME_FlywheelState_IS_FLY;
CFE_TIME_Global.Forced2Fly = true;
CFE_TIME_Global.OneTimeDirection = CFE_TIME_AdjustDirection_ADD;
CFE_TIME_Global.OneHzDirection = CFE_TIME_AdjustDirection_ADD;
CFE_TIME_Global.IsToneGood = true;
CFE_TIME_Global.GetReferenceFail = true;
StateFlags = CFE_TIME_FLAG_CLKSET | CFE_TIME_FLAG_FLYING | CFE_TIME_FLAG_SRCINT | CFE_TIME_FLAG_SIGPRI |
CFE_TIME_FLAG_SRVFLY | CFE_TIME_FLAG_CMDFLY | CFE_TIME_FLAG_ADD1HZ | CFE_TIME_FLAG_ADDADJ |
CFE_TIME_FLAG_ADDTCL | CFE_TIME_FLAG_GDTONE | CFE_TIME_FLAG_REFERR;
#if (CFE_PLATFORM_TIME_CFG_SERVER == true)
StateFlags |= CFE_TIME_FLAG_SERVER;
#endif
UtAssert_UINT32_EQ(CFE_TIME_GetClockInfo(), StateFlags);
CFE_TIME_Global.GetReferenceFail = false;
}
/*
** Test operations on time (add, subtract, compare)
*/
void Test_TimeOp(void)
{
CFE_TIME_SysTime_t time1, time2, result, exp_result;
UtPrintf("Begin Test Time Operations");
/* Initialize to zero time values */
time1.Subseconds = 0;
time1.Seconds = 0;
time2.Subseconds = 0;
time2.Seconds = 0;
exp_result.Subseconds = 0;
exp_result.Seconds = 0;
/* Test adding with both times equal zero */
result = CFE_TIME_Add(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Add, Time A = time B = 0 seconds/subseconds");
/* Test subtracting with both times equal zero */
result = CFE_TIME_Subtract(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Subtract, Time A = time B = 0 seconds/subseconds");
/* Test comparing with both times equal zero */
UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_EQUAL);
/* Initialize to maximum time values */
time1.Subseconds = 0xffffffff;
time1.Seconds = 0xffffffff;
time2.Subseconds = 0xffffffff;
time2.Seconds = 0xffffffff;
/* Test adding two maximum time values (extreme time rollover case) */
exp_result.Subseconds = 0xfffffffe;
exp_result.Seconds = 0xffffffff;
result = CFE_TIME_Add(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Add, Time A = time B = maximum seconds/subseconds (rollover)");
/* Test subtracting two maximum time values (zero result) */
exp_result.Subseconds = 0;
exp_result.Seconds = 0;
result = CFE_TIME_Subtract(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Subtract, Time A = time B = maximum seconds/subseconds (zero result)");
/* Test comparing two maximum time values */
UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_EQUAL);
/* Initialize to single time value at maximum subseconds */
time1.Subseconds = 0xffffffff;
time1.Seconds = 0xffff0000;
time2.Subseconds = 0x00000001;
time2.Seconds = 0x0000ffff;
/* Test adding two time values; time A > time B (minimal time
* rollover case)
*/
exp_result.Subseconds = 0;
exp_result.Seconds = 0;
result = CFE_TIME_Add(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), "CFE_TIME_Add, Time A > time B (rollover)");
/* Test subtracting two time values; time A > time B */
exp_result.Subseconds = 0xfffffffe;
exp_result.Seconds = 0xfffe0001;
result = CFE_TIME_Subtract(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), "CFE_TIME_Subtract, Time A > time B");
/* Test comparing two time values; time A > time B (assumes time has
* rolled over)
*/
UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_A_LT_B);
/* Test adding two time values; time A < time B */
exp_result.Subseconds = 0;
exp_result.Seconds = 0;
result = CFE_TIME_Add(time2, time1);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), "CFE_TIME_Add, Time A < time B");
/* Test subtracting two time values; time A < time B (rollover) */
exp_result.Subseconds = 0x00000002;
exp_result.Seconds = 0x0001fffe;
result = CFE_TIME_Subtract(time2, time1);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t), "CFE_TIME_Subtract, Time A < time B (rollover)");
/* Test comparing two time values; time A < time B (assumes time has
* rolled over)
*/
UtAssert_INT32_EQ(CFE_TIME_Compare(time2, time1), CFE_TIME_A_GT_B);
/* Initialize so that only subseconds are different; seconds are
* the same
*/
time1.Subseconds = 30;
time1.Seconds = 3;
time2.Subseconds = 29;
time2.Seconds = 3;
/* Test adding two time values; time A subseconds > time B subseconds
* (seconds same) */
exp_result.Subseconds = 59;
exp_result.Seconds = 6;
result = CFE_TIME_Add(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Add, Time A subseconds > time B subseconds (seconds same)");
/* Test subtracting two time values; time A subseconds > time B
* subseconds (seconds same)
*/
exp_result.Subseconds = 1;
exp_result.Seconds = 0;
result = CFE_TIME_Subtract(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Subtract, Time A subseconds > time B subseconds (seconds same)");
/* Test comparing two time values; time A subseconds > time B subseconds
* (seconds same)
*/
UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_A_GT_B);
/* Test adding two time values; time A subseconds < time B subseconds
* (seconds same)
*/
exp_result.Subseconds = 59;
exp_result.Seconds = 6;
result = CFE_TIME_Add(time2, time1);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Add, Time A subseconds < time B subseconds (seconds same)");
/* Test subtracting two time values; time A subseconds < time B
* subseconds (seconds same)
*/
exp_result.Subseconds = 0xffffffff;
exp_result.Seconds = 0xffffffff;
result = CFE_TIME_Subtract(time2, time1);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Subtract, Time A subseconds < time B subseconds (seconds same)");
/* Test comparing two time values; time A subseconds < time B subseconds
* (seconds same)
*/
UtAssert_INT32_EQ(CFE_TIME_Compare(time2, time1), CFE_TIME_A_LT_B);
/* Initialize so that only seconds are different; subseconds are
* the same
*/
time1.Subseconds = 18;
time1.Seconds = 8;
time2.Subseconds = 18;
time2.Seconds = 7;
/* Test adding two time values; time A seconds > time B seconds
* (subseconds same)
*/
exp_result.Subseconds = 36;
exp_result.Seconds = 15;
result = CFE_TIME_Add(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Add, Time A seconds > time B seconds (subseconds same)");
/* Test subtracting two time values; time A seconds > time B seconds
* (subseconds same)
*/
exp_result.Subseconds = 0;
exp_result.Seconds = 1;
result = CFE_TIME_Subtract(time1, time2);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Subtract, Time A seconds > time B seconds (subseconds same)");
/* Test comparing two time values; time A seconds > time B seconds
* (subseconds same)
*/
UtAssert_INT32_EQ(CFE_TIME_Compare(time1, time2), CFE_TIME_A_GT_B);
/* Test adding two time values; time A seconds < time B seconds
* (subseconds same)
*/
exp_result.Subseconds = 36;
exp_result.Seconds = 15;
result = CFE_TIME_Add(time2, time1);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Add, Time A seconds < time B seconds (subseconds same)");
/* Test subtracting two time values; time A seconds < time B seconds
* (subseconds same)
*/
exp_result.Subseconds = 0;
exp_result.Seconds = 0xffffffff;
result = CFE_TIME_Subtract(time2, time1);
UtAssert_MemCmp(&result, &exp_result, sizeof(CFE_TIME_SysTime_t),
"CFE_TIME_Subtract, Time A seconds < time B seconds (subseconds same)");
/* Test comparing two time values; time A seconds < time B seconds
* (subseconds same)
*/
UT_InitData();
UtAssert_INT32_EQ(CFE_TIME_Compare(time2, time1), CFE_TIME_A_LT_B);
}
/*
** Test time conversion functions
*/
void Test_ConvertTime(void)
{
CFE_TIME_SysTime_t METTime;
CFE_TIME_SysTime_t resultTime;
CFE_TIME_SysTime_t expectedMET2SCTime;
volatile CFE_TIME_ReferenceState_t *RefState;
UtPrintf("Begin Test Convert Time");
UT_InitData();
/* Test MET to SCTF conversion */
METTime.Seconds = 0;
METTime.Subseconds = 0;
RefState = CFE_TIME_StartReferenceUpdate();
RefState->AtToneSTCF.Seconds = 7240; /* 01:00:00.00000 */
RefState->AtToneSTCF.Subseconds = 45;
RefState->AtToneLeapSeconds = 32;
#if (CFE_MISSION_TIME_CFG_DEFAULT_TAI == true)
/* TAI time derived = MET + STCF */
expectedMET2SCTime.Seconds = 7240;
#else
/* UTC time derived = MET + STCF - Leaps */
expectedMET2SCTime.Seconds = 7208;
#endif
expectedMET2SCTime.Subseconds = 45;
CFE_TIME_FinishReferenceUpdate(RefState);
resultTime = CFE_TIME_MET2SCTime(METTime);
UtAssert_UINT32_EQ(resultTime.Seconds, expectedMET2SCTime.Seconds);
UtAssert_UINT32_EQ(resultTime.Subseconds, expectedMET2SCTime.Subseconds);
/* NOTE: Microseconds <-> Subseconds conversion routines are implemented
* as part of OS_time_t in OSAL, and are coverage tested there. CFE time
* conversions are now just wrappers of these OSAL routines.
* This should only sanity-check basic values to get coverage of the CFE
* wrappers. Testing of value corner cases / rounding should be limited to
* OSAL coverage test. */
/* Test subseconds to microseconds conversion; zero subsecond value */
UtAssert_UINT32_EQ(CFE_TIME_Sub2MicroSecs(0), 0);
/* Test subseconds to microseconds conversion; half second */
UtAssert_UINT32_EQ(CFE_TIME_Sub2MicroSecs(0x80000000), 500000);
/* Test subseconds to microseconds conversion; subseconds exceeds
* microseconds limit
*/
UtAssert_UINT32_EQ(CFE_TIME_Sub2MicroSecs(0xffffffff), 999999);
/* Test microseconds to subseconds conversion; zero microsecond value */
UtAssert_UINT32_EQ(CFE_TIME_Micro2SubSecs(0), 0);
/* Test microseconds to subseconds conversion; microseconds exceeds
* maximum limit
*/
UtAssert_UINT32_EQ(CFE_TIME_Micro2SubSecs(0xffffffff), 0xffffffff);
}
/*
** Test function for creating a text string representing the date and time
**
** NOTE: Test results depend on the epoch values in cfe_mission_cfg.h (the
** tests below assume an epoch of 1980-001-00:00:00.00000). Full
** coverage is possible only when CFE_MISSION_TIME_EPOCH_SECOND > 0
*/
void Test_Print(void)
{
char timeBuf[CFE_TIME_PRINTED_STRING_SIZE];
char expectedBuf[CFE_TIME_PRINTED_STRING_SIZE];
CFE_TIME_SysTime_t time;
bool usingDefaultEpoch = true;
UtPrintf("Begin Test Print");
if (CFE_MISSION_TIME_EPOCH_YEAR != 1980 || CFE_MISSION_TIME_EPOCH_DAY != 1 || CFE_MISSION_TIME_EPOCH_HOUR != 0 ||
CFE_MISSION_TIME_EPOCH_MINUTE != 0 || CFE_MISSION_TIME_EPOCH_SECOND != 0)
{
UtPrintf("Custom epoch time requires manual inspection for CFE_TIME_Print");
usingDefaultEpoch = false;
}
/* Test with zero time value */
time.Subseconds = 0;
time.Seconds = 0;
CFE_TIME_Print(timeBuf, time);
if (usingDefaultEpoch)
{
strcpy(expectedBuf, "1980-001-00:00:00.00000");
CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf));
}
else
{
UtAssertEx(false, UTASSERT_CASETYPE_MIR, __FILE__, __LINE__,
"Confirm adding seconds = %u, subseconds = %u to configured EPOCH results in time %s", time.Seconds,
time.Subseconds, timeBuf);
}
/* Test with a time value that causes seconds >= 60 when
* CFE_MISSION_TIME_EPOCH_SECOND > 0
*/
time.Subseconds = 0;
time.Seconds = 59;
CFE_TIME_Print(timeBuf, time);
if (usingDefaultEpoch)
{
strcpy(expectedBuf, "1980-001-00:00:59.00000");
CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf));
}
else
{
UtAssertEx(false, UTASSERT_CASETYPE_MIR, __FILE__, __LINE__,
"Confirm adding seconds = %u, subseconds = %u to configured EPOCH results in time %s", time.Seconds,
time.Subseconds, timeBuf);
}
/* Test with mission representative time values */
time.Subseconds = 215000;
time.Seconds = 1041472984;
CFE_TIME_Print(timeBuf, time);
if (usingDefaultEpoch)
{
strcpy(expectedBuf, "2013-001-02:03:04.00005");
CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf));
}
else
{
UtAssertEx(false, UTASSERT_CASETYPE_MIR, __FILE__, __LINE__,
"Confirm adding seconds = %u, subseconds = %u to configured EPOCH results in time %s", time.Seconds,
time.Subseconds, timeBuf);
}
/* Test with maximum seconds and subseconds values */
time.Subseconds = 0xffffffff;
time.Seconds = 0xffffffff;
CFE_TIME_Print(timeBuf, time);
if (usingDefaultEpoch)
{
strcpy(expectedBuf, "2116-038-06:28:15.99999");
CFE_UtAssert_STRINGBUF_EQ(timeBuf, sizeof(timeBuf), expectedBuf, sizeof(expectedBuf));
}
else
{
UtAssertEx(false, UTASSERT_CASETYPE_MIR, __FILE__, __LINE__,
"Confirm adding seconds = %u, subseconds = %u to configured EPOCH results in time %s", time.Seconds,
time.Subseconds, timeBuf);
}
}
/*
** Test function for use with register and unregister synch callback API tests
*/
int32 ut_time_MyCallbackFunc(void)
{
ut_time_CallbackCalled++;
return CFE_SUCCESS;
}
/*
** Test registering a synchronization callback function; report results
*/
void Test_RegisterSyncCallbackTrue(void)
{
uint32 AppIndex;
UtPrintf("Begin Test Register Synch Callback");
UT_InitData();
/*
* One callback per application is allowed; the first should succeed,
* the second should fail.
*/
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(CFE_ES_GetAppID), 1, -1);
CFE_TIME_Global.SynchCallback[0].Ptr = NULL;
UtAssert_INT32_EQ(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc), -1);
/* Test registering the callback function the maximum number of times,
* then attempt registering one more time
*/
UT_InitData();
/*
* One callback per application is allowed; the first should succeed,
* the second should fail.
*/
CFE_UtAssert_SUCCESS(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc));
UtAssert_INT32_EQ(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc), CFE_TIME_TOO_MANY_SYNCH_CALLBACKS);
AppIndex = 2;
UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false);
CFE_UtAssert_SUCCESS(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc));
/*
* This test case should not be possible in real flight as ES should never
* return "success" with an appid out of range, but nonetheless
* we need to make sure we do not overwrite our own memory here.
*/
AppIndex = 99999;
UT_SetDataBuffer(UT_KEY(CFE_ES_AppID_ToIndex), &AppIndex, sizeof(AppIndex), false);
UtAssert_INT32_EQ(CFE_TIME_RegisterSynchCallback(&ut_time_MyCallbackFunc), CFE_TIME_TOO_MANY_SYNCH_CALLBACKS);
}
/*
** Test external tone signal detection
*/
void Test_ExternalTone(void)
{
UtPrintf("Begin Test External Tone");
UT_InitData();
UT_SetBSP_Time(123, 0);
CFE_TIME_Global.ToneSignalLatch.Seconds = 0;
CFE_TIME_Global.ToneSignalLatch.Subseconds = 0;
CFE_TIME_ExternalTone();
UtAssert_UINT32_EQ(CFE_TIME_Global.ToneSignalLatch.Seconds, 123);
UtAssert_UINT32_EQ(CFE_TIME_Global.ToneSignalLatch.Subseconds, 0);
}
/*
** Test setting time data from an external source
*/
void Test_External(void)
{
#if (CFE_PLATFORM_TIME_CFG_SRC_MET == true || CFE_PLATFORM_TIME_CFG_SRC_GPS == true || \
CFE_PLATFORM_TIME_CFG_SRC_TIME == true)
CFE_TIME_SysTime_t settime = {5, 4};
#endif
UtPrintf("Begin Test External Time Set");
#if (CFE_PLATFORM_TIME_CFG_SRC_MET == true)
/* Test setting time data from MET using an external source with the clock