Android Question time server

coldteam

Active Member
Licensed User
Longtime User
hi everyone

I want to make an improvement in the time , do you google service or the server that transmits real-time comparison with a timer ?
 

sonicmayne

Member
Licensed User
Longtime User
This will log the time and delay to the B4A logs, using the SaxParser and HttpUtils2 libraries:
B4X:
Sub GetTime
    Dim DL As HttpJob
    DL.Initialize("Time", Me)
    DL.Download("http://nist.time.gov/actualtime.cgi?lzbc=siqm9b")
End Sub

Sub JobDone(Job As HttpJob)
    Select Job.JobName
        Case "Time"
            Dim Sax As SaxParser
            Sax.Initialize
            Sax.Parse(Job.GetInputStream, "Time")
    End Select
End Sub

Sub Time_StartElement (Uri As String, Name As String, Attributes As Attributes)
    Select Name
        Case "timestamp"
            Log("Timestamp: " & Attributes.GetValue2("", "time"))
            Log("Delay: " & Attributes.GetValue2("","delay"))
    End Select
End Sub

Call it like:
B4X:
GetTime
 
Upvote 0

coldteam

Active Member
Licensed User
Longtime User
thank you very much , do not play with html in b4a before. I do a timer in the game, the player expected or bought. when the code is ready to throw off the forum full operation code! :/
 
Upvote 0
Top