name22

RtlTimeToSecondsSince1970 - Convert system time to unix time

Jul 20th, 2013
154
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; #FUNCTION# ====================================================================================================================
  2. ; Name ..........: _RtlTimeToSecondsSince1970
  3. ; Description ...: Converts the specified 64-bit system time to the number of seconds since the beginning of January 1, 1970.
  4. ; Syntax ........: _RtlTimeToSecondsSince1970($_iTime[, $_hNtdll = Default])
  5. ; Parameters ....: $_iTime              - 64-bit integer specifying the time in 100 nanosecond intervals since January 1, 1601 (UTC).
  6. ;                  $_hNtdll             - [optional] Handle to an opened Ntdll.dll file
  7. ; Return values .: None
  8. ; Author ........: name22 (www.autoit.de)
  9. ; Modified ......:
  10. ; Remarks .......:
  11. ; Related .......: _NtQuerySystemTime
  12. ; Link ..........: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724928%28v=vs.85%29.aspx
  13. ; Example .......: Yes
  14. ; ===============================================================================================================================
  15. Func _RtlTimeToSecondsSince1970($_iTime, $_hNtdll = Default)
  16.     If $_hNtdll = Default Then $_hNtdll = "Ntdll.dll"
  17.  
  18.     $_aRet = DllCall($_hNtdll, "BOOL", "RtlTimeToSecondsSince1970", "INT64*", $_iTime, "INT64*", "")
  19.     If @error Then Return SetError(1, 0, -1)
  20.  
  21.     Return $_aRet[2]
  22. EndFunc
RAW Paste Data