void OnStart()
{
//--- 获取本地时间,GMT和GMT与本地计算机时间之间的差值(秒)
datetime time_local=TimeLocal();
datetime time_gmt =TimeGMT();
int offset =TimeGMTOffset();
//--- 在日志中显示获得的时间和偏移值
PrintFormat("Local Time: %s, GMT Time: %s, Seconds Offset: %+d", (string)time_local, (string)time_gmt, offset);
/*
Result:
Local Time: 2024.04.18 19:35:52, GMT Time: 2024.04.18 12:35:52, Seconds Offset: -25200
*/
}
|