Server Time

Hi all,

i want to fetch the time from a server (since os.time can be manipulated by changing date).

Now, since i am using gamecenter and the store api, is there a way to fetch the date from a property there?

Otherwise I would need to fetch the time by REST api.

Any luck on fetching time from a server?

This might work for you:
 

http://www.timeapi.org/

Rob

Cool! Thanks Rob!

Im going to use that timeapi and save it in facebook/score so I can tell who reached 65miles in my game first. Unless there is another way where I can get the date and time I posted my miles to Facebook/score?

Thanks Pete

*update:

facebook/score can only hold 10 digits. After getting time from timeapi “2015 06 30 12:30:11” and adding my 2 digit miles that makes 16 digits. This option is out of the question.

Anyone know how I can get the date and time when I write to facebook/score?

Many thanks!

in http://www.timeapi.org/ you can build your own output, i believe you can do what you want there, try messing with:

http://www.timeapi.org/utc/now?\a%20\b%20\d%20\I:\M:\S%20\Z%20\Y

there are ways also that you can control time in cliente side. you can create a file with the time you want…and in the end compare it to see if its newer or older. if you need to constant compare the time, its possible to, with a little more work using Runtime. but i believe the server side is the way to go.

@carloscosta - I’m trying to save the data(date,time&milesRan) on Facebook Score API so that others players can see their ranking. e.g. 1st, 2nd and 3rd or if a few players reached 65miles then who was first? Saving data on the device won’t work because everyone has to see the data as well. If I can get the date and time when player wrote to their Facebook/score directory then all I have to do is store the milesRan and not the date and time. Unfortunately Facebook Score API can only store 10 digits. I think Facebook has created_date and created_time but not too show how to access that.

data to save

example 1)  2015 07 01 12:30:11 65   – full date(Y,m,d),time(I,M,S),milesRan (16 digits) 

example 2)  07 01 12:30:11 65            – date(m,d),time(I,M,S),milesRan (12 digits) 

example 3)  07 01 12:30 65                 – date(m,d),time(I,M),milesRan (10 digits)

example 3 might work but example 1 would be the best

If I can get the date and time when user wrote to facebook/score then all I have to do is save the milesRan… It would be perfect!!

Or maybe…

  1. I can check out Achievements API on Facebook?

  2. I need to make an SQL server to hold my data?

Those are all new to me so if anyone have any step by step I would greatly appreciate it!

Mahalo!

 

http://www.timeapi.org/utc/now?\d%20\m%20\I:\M

will give you 8 digit return like you wanted. but you can get any date from the server and on client side with string manipulation you can get whatever you want.

scores are posted from your app? if so why dont you use the finish listner to get the time there?

do you know how to get the date and time when a person writes to their Facebook/score directory? another player is reading his friends rating so he/she has to read their date, time and milesRan. When that data is retrieved then the app can perform a sort on all friends playing by date,time and milesRan.

nope i don’t know to get the date and time from their facebook/score. I don’t use facebook, in fact i dont even have a facebook account (last man on earth).

you can always duplicate the score in a database and update it same time you update facebook score. in the database you will have all fields you need, the userId,userName,date, miles. you can retrieve whenever you want from the database in the date order you wanted.

@ carloscosta - Yeah, I figured I would have to create a database so I’m creating a MySQL database on my server and duplicate just the experience points on FB.

Non-FB users - can see their ranking ONLY on the server.

FB users - can see both ranking on the server and FB friends ranking.

Did some research and it seems like I have to use PHP as the medium to communicate from device to server.

update: http://www.timeapi.org/utc/now?\d%20\m%20\I:\M don’t work… is there another server I can use?

They may be temporarily down. You can use google.com and search for time api to find a host of options that might service your needs.

if your having the database in your server and if your getting the info from your app from it, you can get the date from your server too.

Any luck on fetching time from a server?

This might work for you:
 

http://www.timeapi.org/

Rob

Cool! Thanks Rob!

Im going to use that timeapi and save it in facebook/score so I can tell who reached 65miles in my game first. Unless there is another way where I can get the date and time I posted my miles to Facebook/score?

Thanks Pete

*update:

facebook/score can only hold 10 digits. After getting time from timeapi “2015 06 30 12:30:11” and adding my 2 digit miles that makes 16 digits. This option is out of the question.

Anyone know how I can get the date and time when I write to facebook/score?

Many thanks!

in http://www.timeapi.org/ you can build your own output, i believe you can do what you want there, try messing with:

http://www.timeapi.org/utc/now?\a%20\b%20\d%20\I:\M:\S%20\Z%20\Y

there are ways also that you can control time in cliente side. you can create a file with the time you want…and in the end compare it to see if its newer or older. if you need to constant compare the time, its possible to, with a little more work using Runtime. but i believe the server side is the way to go.

@carloscosta - I’m trying to save the data(date,time&milesRan) on Facebook Score API so that others players can see their ranking. e.g. 1st, 2nd and 3rd or if a few players reached 65miles then who was first? Saving data on the device won’t work because everyone has to see the data as well. If I can get the date and time when player wrote to their Facebook/score directory then all I have to do is store the milesRan and not the date and time. Unfortunately Facebook Score API can only store 10 digits. I think Facebook has created_date and created_time but not too show how to access that.

data to save

example 1)  2015 07 01 12:30:11 65   – full date(Y,m,d),time(I,M,S),milesRan (16 digits) 

example 2)  07 01 12:30:11 65            – date(m,d),time(I,M,S),milesRan (12 digits) 

example 3)  07 01 12:30 65                 – date(m,d),time(I,M),milesRan (10 digits)

example 3 might work but example 1 would be the best

If I can get the date and time when user wrote to facebook/score then all I have to do is save the milesRan… It would be perfect!!

Or maybe…

  1. I can check out Achievements API on Facebook?

  2. I need to make an SQL server to hold my data?

Those are all new to me so if anyone have any step by step I would greatly appreciate it!

Mahalo!

 

http://www.timeapi.org/utc/now?\d%20\m%20\I:\M

will give you 8 digit return like you wanted. but you can get any date from the server and on client side with string manipulation you can get whatever you want.

scores are posted from your app? if so why dont you use the finish listner to get the time there?

do you know how to get the date and time when a person writes to their Facebook/score directory? another player is reading his friends rating so he/she has to read their date, time and milesRan. When that data is retrieved then the app can perform a sort on all friends playing by date,time and milesRan.

nope i don’t know to get the date and time from their facebook/score. I don’t use facebook, in fact i dont even have a facebook account (last man on earth).

you can always duplicate the score in a database and update it same time you update facebook score. in the database you will have all fields you need, the userId,userName,date, miles. you can retrieve whenever you want from the database in the date order you wanted.