Hi again,
I'm still trying to find this perplexing problem...
NIST Time is returning as such on 2/21/2001 for me:
51961 01-02-21 15:08:07 00 0 0 679.4 UTC(NIST) *
so I separate out the date/time and send it to VarDateFromStr, and it sets my clock about 20 years off...
I posted something about this earlier and this is the only fix I can come up with..
Does someone have code to READ the modified julian date instead of using the string??? That sure would be easier...
What other method of converting this date to my current date format do I have???
------------------
Scott
[This message has been edited by Scott Turchin (edited February 21, 2001).]
I'm still trying to find this perplexing problem...
NIST Time is returning as such on 2/21/2001 for me:
51961 01-02-21 15:08:07 00 0 0 679.4 UTC(NIST) *
so I separate out the date/time and send it to VarDateFromStr, and it sets my clock about 20 years off...
I posted something about this earlier and this is the only fix I can come up with..
Does someone have code to READ the modified julian date instead of using the string??? That sure would be easier...
What other method of converting this date to my current date format do I have???
Code:
'Check atomic clock and get Return into UTCTime 'For code purposes: UTCTime = 51961 01-02-21 15:08:07 00 0 0 679.4 UTC(NIST) * UTCDate = Parse$(UTCTime, Any " ",2) UTCTimeOnly = Parse$(UTCTime, Any " ",3) ' Convert date and time to a SYSTEMTIME structure using a date VARIANT vbDate = StrToVbDate(UTCDate + " " + UTCTimeOnly) VariantTimeToSystemTime ByVal vbDate, st 'Now I can use SetSystemTime ' ' ' Function StrToVbDate(ByVal dt As String) As Double Local x As Long Local y As String Local vbdate As Double Local lResult As Long Local stDay As String Local styear As String Local stmonth As String ' 01-02-21 stmonth = Mid$(dt,4,2) stday = Mid$(dt,7,2) stYear = Mid$(dt,1,2) Mid$(dt,1,2) = stmonth Mid$(dt,4,2) = stday Mid$(dt,7,2) = styear dt = uString(dt) lResult = VarDateFromStr(ByVal StrPtr(dt),0, 0, vbdate) Select Case lResult Case %FALSE Function = vbdate Case %DISP_E_TYPEMISMATCH 'Can't convert string to date, set 0 and invalidate Function = 0 Case %DISP_E_OVERFLOW Function = -1 Case %E_OUTOFMEMORY 'Throw exception here Function = %FALSE End Select End If End Function
Scott
[This message has been edited by Scott Turchin (edited February 21, 2001).]
Comment