4D Internet Commands v16

NET_Time

Home

 
4D Internet Commands v16
NET_Time

NET_Time 


 

NET_Time ( hostName ; date ; time ; offset ) -> Function result 
Parameter Type   Description
hostName  String in Host name or IP address
date  Date in Date
time  Longint in Time, expressed as seconds since midnight
offset  Integer in Hours to offset
Function result  Integer in Error Code

Given the host name or IP address to an Internet Time server, the NET_Time command will obtain the current date and time from the machine and apply any offset needed to convert to the user's local time.

Note: This command does not affect the computer's internal clock.

hostName is the host name or IP address of an Internet Time server.

date is a 4D Date returned, containing the resulting date after the offset has been applied.

time is a LongInt value returned, containing the resulting time after the offset has been applied. The value represents the seconds since midnight on date. See the example below for a method to convert this value to a 4D Time variable.

offset is the number of hours to add or subtract from the base time values. Internet Time Servers express their values in Universal Time (Greenwich Mean Time). Even if the time server is in your geographic region, it is likely that you will need to supply an offset value to compensate for the difference between your local time and Universal time.

Example  

The following example obtains the Universal Time from the Time server at "apple.com". The command then subtracts the seven hours specified as the Offset and returns the resulting Date and Time (Time is expressed as a Longint value, which can then be converted using 4D's Time string command, as below).

 C_DATE(vNetDate)
 C_LONGINT(vNetTime)
 C_TIME(vTime)
 C_LONGINT(vOffset)
 If(ERRCHECK("NET_Time";NET_Time("www.apple.com";vNetDate;vNetTime;-7)))
    vTime:=Time(Time string(vNetTime)) //Convert the LongInt time to a 4D Time
 End if

 
PROPERTIES 

Product: 4D Internet Commands
Theme: IC Internet
Number: 88924

 
HISTORY 

Created: 4D Internet Commands 6.5

 
ARTICLE USAGE

4D Internet Commands ( 4D Internet Commands v16)