blob: 5ba470ccb1c7ce37957d1798a2d4d60da5a9c054 [file] [log] [blame]
Vadim Bendebury56797522015-05-20 10:32:25 -07001// 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"
10TPM_RC
11TPM2_ReadClock(
12 ReadClock_Out *out // OUT: output parameter list
13 )
14{
15// Command Output
Vadim Bendebury56797522015-05-20 10:32:25 -070016 out->currentTime.time = g_time;
17 TimeFillInfo(&out->currentTime.clockInfo);
18
Vadim Bendebury50a01452015-10-21 15:00:04 -070019#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 Bendebury56797522015-05-20 10:32:25 -070031 return TPM_RC_SUCCESS;
32}