Getting the current date and time
Tcl offers time
package that can be used to query current time using either official servers for providing it or local servers within our network.
One of the reasons is that applications that operate over the network need to know and use the current time. For example, if multiple machines register events and/or data updates based on the time they occurred, if their system clocks are not synchronized, events might be reported out of order.
In majority of cases the system clock is synchronized so all applications use the correct time, but in some cases it might only be possible for the application to synchronize its time and handle it properly whenever sending a time.
The time
package offers similar commands to dns
and http
ones. The query can be run using the time::gettime
and time::getsntp
commands. The first command queries the time using the Network Time Protocol (NTP) and second one uses the Simple Network Time Protocol (SNTP), which is a simplified version...