Vadim Bendebury | 5679752 | 2015-05-20 10:32:25 -0700 | [diff] [blame] | 1 | // This file was extracted from the TCG Published |
| 2 | // Trusted Platform Module Library |
| 3 | // Part 3: Commands |
| 4 | // Family "2.0" |
| 5 | // Level 00 Revision 01.16 |
| 6 | // October 30, 2014 |
| 7 | |
| 8 | #include "InternalRoutines.h" |
| 9 | #include "ReadClock_fp.h" |
| 10 | TPM_RC |
| 11 | TPM2_ReadClock( |
| 12 | ReadClock_Out *out // OUT: output parameter list |
| 13 | ) |
| 14 | { |
| 15 | // Command Output |
Vadim Bendebury | 5679752 | 2015-05-20 10:32:25 -0700 | [diff] [blame] | 16 | out->currentTime.time = g_time; |
| 17 | TimeFillInfo(&out->currentTime.clockInfo); |
| 18 | |
Vadim Bendebury | 50a0145 | 2015-10-21 15:00:04 -0700 | [diff] [blame] | 19 | #ifndef EMBEDDED_MODE |
| 20 | { |
| 21 | UINT64 start_time = _plat__ClockTimeFromStart(); |
| 22 | // When running on a simulator, some tests fail, because two commands |
| 23 | // invoked back to back happen to run within the same millisecond, but |
| 24 | // the test expects time readings to be different. Modifying the tests |
| 25 | // is more involved, let's just wait a couple of milliseconds here to |
| 26 | // avoid those tests' false negatives. |
| 27 | while ((_plat__ClockTimeFromStart() - start_time) < 2) |
| 28 | ; |
| 29 | } |
| 30 | #endif |
Vadim Bendebury | 5679752 | 2015-05-20 10:32:25 -0700 | [diff] [blame] | 31 | return TPM_RC_SUCCESS; |
| 32 | } |