MCPcopy Create free account
hub / github.com/cpputest/cpputest / C2000TimeInMillis

Function C2000TimeInMillis

src/Platforms/C2000/UtestPlatform.cpp:103–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101void (*PlatformSpecificRestoreJumpBuffer)(void) = C2000RestoreJumpBuffer;
102
103static long C2000TimeInMillis()
104{
105 /* The TI c2000 platform does not have Posix support and thus lacks struct timespec.
106 * Also, clock() always returns 0 in the simulator. Hence we work with struct tm.tm_hour
107 * This has two consequences:
108 * (1) We need to sum up the part in order to get an "elapsed since" time value,
109 * rather than just using tm_sec.
110 * (2) There is a possibility of overflow, since we stop at the hour
111 * (3) Resolution is 1 s, even though we return ms.
112 */
113 time_t t = time((time_t*)0);
114 struct tm * ptm = gmtime(&t);
115 long result = (long)
116 ((ptm->tm_sec + ptm->tm_min * (time_t)60 + ptm->tm_hour * (time_t)3600) * (time_t)1000);
117 return result;
118}
119
120static const char* TimeStringImplementation()
121{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected