Advertisement
C_Volume2 Math/ Dates #72693

Calculate InternetTime

The function InternetTime() calculates the internettime, the new time standard from Swatch. You only have to call the function.

AI

Yapay Zeka Özeti: 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.

Kaynak Kod
original-source
Public Function GetTimeZone(Optional ByRef strTZName As String) As Long
  Dim objTimeZone As TIME_ZONE_INFORMATION
  Dim lngResult As Long
  Dim i As Long
  lngResult = GetTimeZoneInformation&(objTimeZone)
  
  
  Select Case lngResult
   Case 0&, 1& 'use standard time
   GetTimeZone = -(objTimeZone.Bias + objTimeZone.StandardBias) 'into minutes
  
   For i = 0 To 31
     If objTimeZone.StandardName(i) = 0 Then Exit For
     strTZName = strTZName & Chr(objTimeZone.StandardName(i))
   Next
  
   Case 2& 'use daylight savings time
   GetTimeZone = -(objTimeZone.Bias + objTimeZone.DaylightBias) 'into minutes
  
   For i = 0 To 31
     If objTimeZone.DaylightName(i) = 0 Then Exit For
     strTZName = strTZName & Chr(objTimeZone.DaylightName(i))
   Next
  End Select
End Function
Public Function InternetTime()
  Dim tmpH
  Dim tmpS
  Dim tmpM
  Dim itime
  Dim tmpZ
  Dim testtemp As String
  
  tmpH = Hour(Time)
  tmpM = Minute(Time)
  tmpS = Second(Time)
  tmpZ = GetTimeZone
  itime = ((tmpH * 3600 + ((tmpM - tmpZ + 60) * 60) + tmpS) * 1000 / 86400)
  If itime > 1000 Then
   itime = itime - 1000
  ElseIf itime < 0 Then
   itime = itime + 1000
  End If
  InternetTime = itime
End Function
Orijinal Yorumlar (3)
Wayback Machine'den kurtarıldı