playMaker

Author Topic: Network time  (Read 777 times)

escpodgames

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • Assets
Network time
« on: January 29, 2014, 10:09:45 PM »
Hi,

What I need is a universal time value from a server, this is so I can check the time passed since a previous time without relying on the device (which is changeable but the user) there are a bunch of servers like -
http://www.pool.ntp.org/en/

Just wondering if anyone else has tried to take this ... I assume the network actions will be needed.

Padenlee

  • Playmaker Newbie
  • *
  • Posts: 23
  • You can't hit what you don't shoot for!
    • View Profile
    • Personal Site
Re: Network time
« Reply #1 on: January 03, 2017, 04:45:41 PM »
Here is my solution for future humans :)

Use the action WWWPOST or WWWPOST Mobile if on mobile. Have the url point to here:

http://www.timeapi.org/utc/now

This will get you the UTC or Universal Time Clock. You then need to use Get Substring to get the month, day, year, etc into individual strings. Use Build String to recombine the date time into UNIX time which Playmaker actions use :)

Hope this helps!
-Paden Pierry
@padenpierry

escpodgames

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • Assets
Re: Network time
« Reply #2 on: January 03, 2017, 04:48:09 PM »
SUPER THANKS! ;D

dudebxl

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Re: Network time
« Reply #3 on: January 04, 2017, 09:40:17 AM »
You also have the epoch time actions that might help. They should be on the ecosystem (maybe - snipt gone)

http://hutonggames.com/playmakerforum/index.php?topic=13541.0

escpodgames

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • Assets
Re: Network time
« Reply #4 on: March 19, 2017, 11:14:20 PM »
It appears that http://www.timeapi.org/utc/now is no longer working.

@dudebxl
I have tried to use the Epoch actions but always get back the same time (01/01/1970 13:00) How are these actions used to get the correct time?