Is there a way to get server time | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Is there a way to get server time
No permission to create posts
December 7, 2018
10:34 am
Avatar
Deimos

Silver
Members
Forum Posts: 5
Member Since:
January 2, 2018
sp_UserOfflineSmall Offline

Hi, I want to get ThingSpeak's server time in order to calculate how much time has past since the last feed update.
for example, https://api.thingspeak.com/channels/300978/feeds/last returns "created_at":"2018-12-07T15:14:07Z", and if I had server's time as well I could calculate the time difference. It would be perfect to receive server time in the same response. I don't want to rely on another time sources. Is it possible?

December 8, 2018
9:26 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 512
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

The thingSpeak API does not presently provide the server time.

When I write code to get the time, I usually do an update right before I read and then use the created at time.

Another thing you could do would be to run a MATLAB analysis that writes the time to a channel (same or different channel). Set the analysis to run regularly, using a MATLAB analysis.
Then you an compare the time written and created at for the time entry to the created at for the read you are already doing, and deduce the actual server time. I think the best accuracy you can do with a single read is 1-2s.

You can use datetime('now') to get the present time.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
33 Guest(s)

Currently Browsing this Page:
2 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

Epiphoneejf, Bbet1814On, Konstantintus, inalv69, bryancv1, priscillaql69

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457