CurrentTime Property
General info
Label |
Current Time |
Description |
The current time (UTC) as known by the Web API Server. |
Data type |
DateTime |
Type |
Regular |
Code |
2852 |
Symbolic name |
MODEL_PROP_CURRENTTIME |
Lua access code |
syslib.model.properties.CurrentTime |
Available since |
1.34 |
- Parent classes
Attributes
| Name | Tooltip |
|---|---|
| PROP_VISIBLE | The property is visible in DataStudio and can be read by the inmation APIs. |
| PROP_VOLATILE | The property exists during runtime of the service only and is not saved to the image. |
Examples
Read from or write to the CurrentTime property.
-- Read from the CurrentTime
syslib.getvalue("<OBJECT FULL PATH>.CurrentTime")
-- Write to the CurrentTime
syslib.setvalue("<OBJECT FULL PATH>.CurrentTime", syslib.currenttime())
TcpConfig tcpcfg = new TcpConfig() { HostNameOrIp = "localhost", Port = 6512 };
SecurityCredentials sc = new SecurityCredentials() { ProfileName = "<username>", Password = "<password>" };
StatelessInterface sli = new StatelessInterface(tcpcfg);
// Read from the CurrentTime
Result result = sli.ReadValue(sc, new ReadItem("<OBJECT FULL PATH>.CurrentTime"));
// Write to the CurrentTime
Result result = sli.WriteValue(sc, new WriteItem(DateTime.Now, "<OBJECT FULL PATH>.CurrentTime"));