Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

i want get date and time that is not from the mobile device
Started by diego_martinez93 Feb 06 2019 01:46 PM

6 replies to this topic
time without internet connection.
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

diego_martinez93

[GLOBAL: userInfoPane.html]
diego_martinez93
  • Observer

  • 14 posts
  • Corona SDK

I want to get the date and time that is not from the mobile device. No internet connection. I do not want the date of the mobile device since the user can change the date and time. Can you get the date and time without an Internet connection and not from the mobile device?

Thanks



[TOPIC: post.html]
#2

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,819 posts
  • Corona SDK

It's got to come from somewhere, if it's not from the device or the internet, I can't see where else you could get it from.

 

What is the reason? If it's to ensure the user isn't messing with their clock to circumvent time limits or something, you could store the time at random intervals, from the device and internet. If at any point the time is earlier than a time stored previously, you know the user is tampering.



[TOPIC: post.html]
#3

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 878 posts
  • Corona SDK

If you want to tamper proof your app's date and time related functions, you should use a combination of both.

For instance, take the time from a server that you trust and store it locally. Then you use that point to locally track how much time has passed. Once the local clock says that enough time has passed, you check the time from the server again and see if enough time has really passed. This method requires the least amount of bandwidth and works well against tampering. If a user fails to connect to the server, just provide them with a notification to try again later.



[TOPIC: post.html]
#4

GrahamRanson

[GLOBAL: userInfoPane.html]
GrahamRanson
  • Contributor

  • 106 posts
  • Corona SDK

If you want to get the current time from the internet I've just added the ability in to Puggle

require( "puggle.core" )

local onComplete = function( time )
   print( os.date( "%x", time.unix ) )
end
puggle.worldtime:now( onComplete )

This also allows you to check info on past/future dates like this:

require( "puggle.core" )

local onComplete = function( time )
   print( time.isDayLightSavingsTime )
end
puggle.worldtime:get( onComplete, "gmt", "2004-06-12" )


[TOPIC: post.html]
#5

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 2,120 posts
  • Corona SDK

What I do is get the UTC time from my server and then add seconds using an enterFrame().  This stops time changing whilst playing.



[TOPIC: post.html]
#6

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 464 posts
  • Corona SDK

I'm not sure how practical this would be as an implementation, but the question intrigued me, so I've been thinking...

GPS works separately to a data connection, and relies on knowing where 3 satellites are and the distance you are from them both. It has to do this accurately in order to pin point you on the planet. Thus, it should be theoretically possible to compare GPS data with some kind of pre-coded list of where the GPS satellites were at a specific time, and some kind of a fancy algorithm that factors in their current location, their route of orbit, and that pre-coded list.

If I'm right, then you'd be able to use the GPS satellites current location to fairly accurately figure out the current time.

[TOPIC: post.html]
#7

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 878 posts
  • Corona SDK

We seem to all just be throwing ideas around without actually knowing WHY @diego_martinez93  wants to get date and time without the use of Internet or without looking it up from the device. These next level Jedi solutions are cool, but without knowing the why, we can't even know if this is a relevant question.

So, without any further delays, @diego_martinez93, for what reason do you want to accomplish this? :D




[topic_controls]
[/topic_controls]