NET_Time

4D - Documentation   Français   English   German   Japanese   4D Internet Commands, Theme List   4D Internet Commands, Alphabetical List   Back   Previous   Next

version 6.5


NET_Time (hostName; date; time; offset) Integer

ParameterTypeDescription
hostNameStringHost name or IP address
dateDateDate
timeLongintTime, expressed as seconds since midnight
offsetIntegerHours to offset
Function resultIntegerError Code

Description

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_INTEGER(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 

See Also

Time string.


4D - Documentation   Français   English   German   Japanese   4D Internet Commands, Theme List   4D Internet Commands, Alphabetical List   Back   Previous   Next