Get Windows NT Server Time
Returns the time of day from a Windows NT workstation or server. Accounts for time zones. Requires Windows NT.
AI
สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
ซอร์สโค้ด
Public Function Get_ServerTime(ByVal strServerName As String) As String
Dim lngBuffer As Long
Dim strServer As String
Dim lngNet32ApiReturnCode As Long
Dim days As Date
Dim TOD As TIME_OF_DAY
On Error Resume Next
'// Get server time
strServer = StrConv(strServerName, vbUnicode) '// Convert the server name to unicode
lngNet32ApiReturnCode = NetRemoteTOD(strServer, lngBuffer)
If lngNet32ApiReturnCode = 0 Then
CopyMem TOD, ByVal lngBuffer, Len(TOD)
days = DateSerial(70, 1, 1) + (TOD.t_elapsedt / 60 / 60 / 24) '// Convert the elapsed time since 1/1/70 to a date
days = days - (TOD.t_timezone / 60 / 24) '// Adjust for TimeZone differences
Get_ServerTime = days
End If
'// Free pointers from memory
Call NetApiBufferFree(lngBuffer)
End Function
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine