SIMATIC Automation Tool API for .NET framework
6.9 The ICPU interface
6.9.3.3
GetCurrentDateTime method
Return type
Method name
Result
GetCurrentDateTime
Name
Data type
Password
EncryptedString
DateTime
System.DateTime
This method gets the current timestamp for the CPU.
The following example searches the
address, and gets its time.
uint targetIPAddress = 0xC0A80001; // 192.168.0.1
retVal = myNetwork.ScanNetworkDevices(out devices);
if (!retVal.Succeeded)
return;
foreach (IProfinetDevice dev in devices)
{
ICPU devAsCpu = dev as ICPU;
if ((devAsCpu != null) && (devAsCpu.IP == targetIPAddress))
{
}
102
DateTime curTime = new DateTime();
retVal = devAsCpu.GetCurrentDateTime(new EncryptedString(""),
}
Parameters
Parameter type
In
Out
IProfinetDeviceCollection
out curTime);
Description
This method opens a legitimized connec-
tion to the device. Therefore a password
may be required.
Current date and time returned from the
CPU
for a CPU at a specific IP
SIMATIC Automation Tool V2.1 user guide
Manual, V2.1.1 07/2016, A5E33042676-AC