AscySoft Active Member Licensed User Longtime User Aug 3, 2011 #1 Hi. I'm new on this,.. I was looking for a way to synchronise device clock(or at least to obtain a real date/time) using perhaps SNTP or any NTP protocol? This is useful in my future app because I wanna know exactly when somebody create, append delete etc from my sqlite database. Is this thing possible in B4A? (I found at least one app doing this here: ClockSync - synchronize device clock via NTP - Android @ MoDaCo ) PS: in .net compact framework I was able to obtain such info(over gprs)
Hi. I'm new on this,.. I was looking for a way to synchronise device clock(or at least to obtain a real date/time) using perhaps SNTP or any NTP protocol? This is useful in my future app because I wanna know exactly when somebody create, append delete etc from my sqlite database. Is this thing possible in B4A? (I found at least one app doing this here: ClockSync - synchronize device clock via NTP - Android @ MoDaCo ) PS: in .net compact framework I was able to obtain such info(over gprs)
Erel B4X founder Staff member Licensed User Longtime User Aug 3, 2011 #2 NTP protocol is implemented over UDP which is supported. Not sure that it will be simple to do it correctly as you also need to consider the time it took the message to arrive. You can also try to get the time from the GPS. Upvote 0
NTP protocol is implemented over UDP which is supported. Not sure that it will be simple to do it correctly as you also need to consider the time it took the message to arrive. You can also try to get the time from the GPS.
AscySoft Active Member Licensed User Longtime User Aug 3, 2011 #3 Thanks, I will dig into it, but a small example somewhere does exist? Upvote 0
AscySoft Active Member Licensed User Longtime User Aug 3, 2011 #5 Erel said: I don't think so. Click to expand... That's too sad :sign0161: Maybe someday, I will provide help, but I still got a lot to learn until then Upvote 0
Erel said: I don't think so. Click to expand... That's too sad :sign0161: Maybe someday, I will provide help, but I still got a lot to learn until then
AscySoft Active Member Licensed User Longtime User Nov 8, 2011 #6 I checked the Net library and I saw that it is based on Apache Commons Net™ - Overview which support alot of transport protocols including a small NTP/SNTP protocol. So I was wondering, does anybody could point me how to rip/create only this into another b4a librarry? I kinda don't know java... or is anybody else willing to create this? I don't think is to hard, if you know java. thanks Upvote 0
I checked the Net library and I saw that it is based on Apache Commons Net™ - Overview which support alot of transport protocols including a small NTP/SNTP protocol. So I was wondering, does anybody could point me how to rip/create only this into another b4a librarry? I kinda don't know java... or is anybody else willing to create this? I don't think is to hard, if you know java. thanks
D diego Member Licensed User Longtime User Apr 12, 2012 #7 here is an example to get time from internet: date - Get Data from the internet android - Stack Overflow anyone who could translate it to B4A ? :sign0085: Upvote 0
here is an example to get time from internet: date - Get Data from the internet android - Stack Overflow anyone who could translate it to B4A ? :sign0085:
specci48 Well-Known Member Licensed User Longtime User Apr 12, 2012 #8 Hi diego, take a look here. specci48 Upvote 0
AscySoft Active Member Licensed User Longtime User Apr 12, 2012 #9 very quick answer... maybe you could help us translate this too : http://commons.apache.org/net/examples/ntp/NTPClient.java It's based on Apache Commons Net, so I think is well tested Thanks! Upvote 0
very quick answer... maybe you could help us translate this too : http://commons.apache.org/net/examples/ntp/NTPClient.java It's based on Apache Commons Net, so I think is well tested Thanks!
specci48 Well-Known Member Licensed User Longtime User Apr 13, 2012 #10 Can you be more precise and explain what you really want from this library? Which feature are you missing in SPSntp? specci48 Upvote 0
Can you be more precise and explain what you really want from this library? Which feature are you missing in SPSntp? specci48
AscySoft Active Member Licensed User Longtime User Apr 13, 2012 #11 specci48 said: Which feature are you missing in SPSntp? specci48 Click to expand... Take this for example: a list with ntp servers: pool.ntp.org: NTP Servers in Europe, europe.pool.ntp.org Could you implement a property say "ServerName" where the user can set/store his preffered time server... I thank you again for this library. As far as I tested (for 5 minutes yesterday) is good. I mentioned Apache ntp-client only because is open source and well tested/implemented in many application, don't know if this code taken from stackoverflow is the same... So, thanks again! Upvote 0
specci48 said: Which feature are you missing in SPSntp? specci48 Click to expand... Take this for example: a list with ntp servers: pool.ntp.org: NTP Servers in Europe, europe.pool.ntp.org Could you implement a property say "ServerName" where the user can set/store his preffered time server... I thank you again for this library. As far as I tested (for 5 minutes yesterday) is good. I mentioned Apache ntp-client only because is open source and well tested/implemented in many application, don't know if this code taken from stackoverflow is the same... So, thanks again!
specci48 Well-Known Member Licensed User Longtime User Apr 13, 2012 #12 The reason I was asking is that the apache code and your NTPClient.java sample provide a lot a lot of features, most of the them only logged to the console. I'm sure you do not really need all those values so in my eyes it is a bit oversized relying on that library if you only want to get the current time. Deep inside, the apache library uses the same way to get actual time as the simple SPSntp lib. So the results and stability should be the same. Apart from the above I'll take your request and implement the option to set an an own/preffered time server. Just be patient... ... done... specci48 Last edited: Apr 13, 2012 Upvote 0
The reason I was asking is that the apache code and your NTPClient.java sample provide a lot a lot of features, most of the them only logged to the console. I'm sure you do not really need all those values so in my eyes it is a bit oversized relying on that library if you only want to get the current time. Deep inside, the apache library uses the same way to get actual time as the simple SPSntp lib. So the results and stability should be the same. Apart from the above I'll take your request and implement the option to set an an own/preffered time server. Just be patient... ... done... specci48
AscySoft Active Member Licensed User Longtime User Apr 13, 2012 #13 Super. You're the best. Thanks. It's what I wanted. :sign0188: Upvote 0