Real-Time Embedded Multithreading: Using ThreadX and ARM

The time services described in this appendix are:
| tx_time_get | Retrieves the current time |
| tx_time_set | Sets the current time |
Retrieves the current time
ULONG <b class="bold">tx_time_get</b>(VOID)
This service returns the contents of the internal system clock. Each timer-tick increases the internal system clock count by one. The system clock is set to zero during initialization and can be changed to a specific value by the service tx_time_set.
| Note | The physical time interval each timer-tick represents is application-specific. |
None
| system clock ticks | Value of the internal, free running, system clock. |
Initialization, threads, timers, and ISRs
No
ULONG current_time;/* Pickup the current system time, in timer-ticks. */current_time = <b class="bold">tx_time_get</b>();/* Current time now contains a copy of the internal system clock. */
Sets the current time
VOID <b class="bold">tx_time_set</b>(ULONG <b class="bold">new_time</b>)
This service sets the internal system clock to the specified value. Each subsequent timer- tick increases the internal system clock count by one.
| Note | The physical time interval each timer-tick represents is application-specific. |
| new_time | New time to put in the system clock, legal values range from 0 to 0xFFFFFFFF (inclusive). |
None
Threads, timers, and ISRs
No
/* Set the internal system time to 0x1234. */<b class="bold">tx_time_set</b>(0x1234);/* Current time now contains 0x1234 until the next timer interrupt. */