“Time is money“, said Benjamin Franklin, so the more accurately we can count it, the better. We now have a new command for getting a precise UTC time stamp including milliseconds.
You want to have exact logs over a long period? The new Timestamp command allows you to retrieve the date and time in an international standard format with milliseconds. That will make precise time stamping easier for close operations performed in different places over the world.
This command returns a string in ISO8601 format which looks like this: “2016-09-24T07:30:055Z”. Conveniently, the string order of such timestamps is the same as their chronological order so you can easily order your timestamped operations from oldest to newest.
You can use Timestamp in a log file to know precisely when the events occurred. As shown in the example below you can have several operations in the same second:
$vhDocRef:=Append document("TimestampProject.log")
$logWithTimestamp:=Timestamp+Char(Tab)+"Log with timestamp"+Char(Carriage return)
SEND PACKET($vhDocRef;String($logWithTimestamp))
--------------------------------------------------------
Result:
2016-12-12T13:31:29.477Z Log with timestamp
2016-12-12T13:31:29.478Z Connection of user1
2016-12-12T13:31:29.486Z ERROR - Exception of type 'System exception'
2016-12-12T13:31:29.492Z Click on button1684
2016-12-12T13:31:29.502Z [SP_HELP- 1 rows] Command processed
2016-12-12T13:31:29.512Z [SP_HELP- 5 rows] Result set fetched
For more details, we recommend that you take a look at the 4D v16 R2 documentation:
- Timestamp command