| 1 | [wiki:WikiStart Orbit] > [wiki:OTG OTG] > [wiki:OTG/FuncSpec Function Specifications] > Timing Control |
| 2 | |
| 3 | = Timing = |
| 4 | |
| 5 | == Requirements == |
| 6 | OTG and OTR are communication programs which need good timing functions. |
| 7 | OTG needs to control its packet deliver phase. It introduces an "wait" operation between packet transmission. |
| 8 | OTR does not need an "wait" operation, but still need report timestamps of packet reception. |
| 9 | |
| 10 | == Implementation == |
| 11 | An [source:otg/trunk/src/cpp/unixtime.h#latest UnixTime] class is designed for this purpose. |
| 12 | There are two kinds of clocks in this class: |
| 13 | * Absolute Time: Clock refer to an absolute starting time (like 01/01/2000). |
| 14 | * Relative Time: Clock refer to the start of the program(construction of the [source:otg/trunk/src/cpp/unixtime.h#latest UnixTime] class object) |
| 15 | |
| 16 | Absolute time is used for showing the rx_timestamp and tx_timestamp. Because those two timestamps will be compared to show packet delay, they have to be of some absoulte referrence which beyonds its respective process. |
| 17 | |
| 18 | Relative clock is used to report gen_timestamp ( packet generation time). Also, this clock could be paused and resumed. |
| 19 | To realize this, its origin_ (orgin time) would be shifted whenever an pasue-resume operation occured. |
| 20 | |
| 21 | |