Jump to content









Photo

Definition of timestamp in "at" attribute of data stream


  • Please log in to reply
10 replies to this topic

#1 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 21 February 2013 - 07:39 AM

In looking at the API for creating a data stream, there is the "at" attribute, which is a timestamp of the value.  https://www.carriots...agement#streams

 

1.  Please update the documentation to describe what this timestamp is based from.  Is it UNIX?  What is the epoch?  How does one calculate the timestamp?

 

2.  Please consider the following in making this field very valuable and highly usable across all types of devices.

 

  • Allow a value of "at" to be "now".  Then the Carriots server will timestamp the value for when the value was received.  Some devices have no timekeeping ability, and the application is not time sensitive, but still needs some approximate time of data.

 

  • Create an API function that a device can call to get the current time.  Sure, a device can implement a time server protocol, but that could be added trouble, especially in resource constrained equipment.  It would be great if Carriots had a way for a device to query the time, and then also specify the format that it would like the data in.  That way, the end device doesn't need to do conversion, it could apply the data directly.  Maybe a way to use a rule.

 

Thank you.



#2 mcastillo

mcastillo

    Carriots CEO

  • Administrators
  • 34 posts
  • LocationMadrid

Posted 21 February 2013 - 09:55 AM

Thank you Zambiot for your suggestion on: "Allow a value of "at" to be "now".  Then the Carriots server will timestamp the value for when the value was received.  Some devices have no timekeeping ability, and the application is not time sensitive, but still needs some approximate time of data."

 

We think it is a nice feature that we can implement quite easily. We are going o include it on our Roadmap to be delivered ASAP.

 

BR



#3 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 21 February 2013 - 10:05 AM

This is great!  Thank you for the quick response.

 

Please elaborate more about the calculation of the timestamp.  I could use that for the software I am writing now.



#4 alvaro

alvaro

    Carriots CTO

  • Administrators
  • 72 posts

Posted 21 February 2013 - 10:59 AM

Hello Zambiot, you can find more details about how to deal with timestamping on this tutorial: https://www.carriots...als/send_stream

 

 

 

The 'at' field is the epoch time for the stream you can run date +%s to get it in Unix/Linux shell or go to http://www.epochconverter.com/ hre and grab one. 'data' field contains your data.

 

Hope it helps!


Alvaro Everlet

Carriots CTO


#5 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 21 February 2013 - 11:23 AM

Alvaro - The tutorial that you pointed me to only shows that an "at" is included and that is is part of the JSON/XML.  I understand this portion.  The tutorial didn't specify how to calculate the "1355837673" number.  Is that value in seconds?  Is that value in days?  Where should the value start counting from?

 

In the API documentation here:  https://www.carriots...agement#streams

it states the following:  

Timestamp.

Data stream send date
Example: 1340001190

 

So, it is still inconclusive as to how this value is calculated and what units it is in.  A device may track the time of day with a real-time clock.  If it wants to post every five minutes to Carriots, with the proper timestamp on the data, I don't see documentation for anyone to use in writing the software to calculate the Carriots' timestamp value.



#6 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 21 February 2013 - 11:31 AM

In the Hurl and Poster tutorials there isn't any mention about the timestamp.  In the Curl tutorial, there is reference to http://www.epochconverter.com/.  Is it correct to assume the timestamp is a Unix Time Stamp?  http://en.wikipedia.org/wiki/Unix_time  (Also, there is a typo in just after the epochconverter link in the tutorial)

 

If this is a Unix Timestamp, please update the API to state that the timestamp is a Unix Timestamp since the API is the defacto reference of the proper implementation.

 

I'd really recommend implementing a function that a device could call once a day or once a week or on boot-up to get the latest time from Carriots.  Some small microcontrollers and such will have trouble dealing with unix time.  Also consider adding the ability to post time in other formats like ISO8601.

 

Thank you for the posting.  



#7 alvaro

alvaro

    Carriots CTO

  • Administrators
  • 72 posts

Posted 21 February 2013 - 04:40 PM

Hello Zambiot.

 

Yes, I think you're right and we should give more documentation about timestamping. We will prepare and publish it under our Documentation section early. While we release it, let me explain some topics.

 

Our timestamp is a Unix timestamp (seconds since the era, Jan 1st 1970). You can create it with linux 'date +%s' command or an equivalent utility.

 

For synchronizing time in your devices you can use NTP (http://www.pool.ntp.org/zone/asia) protocol while we work on your features proposal that we think are very interesting. We note it: support for "now" reserved word, ISO 8601 dates and time service.

 

Thanks for your feedback!


Alvaro Everlet

Carriots CTO


#8 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 04 March 2013 - 11:53 AM

For those following along at home...

 

The "at":"now" feature is implemented and working.  I just tested it and was able to have Carriots timestamp the data for when it was received.

 

Thank you Carriots for listening and implementing this feature, especially so early in your launch and development.



#9 mcastillo

mcastillo

    Carriots CEO

  • Administrators
  • 34 posts
  • LocationMadrid

Posted 04 March 2013 - 08:53 PM

Thank you Zambiot. This is the Comunity Spirit we want at Carriots. We are building a tool that should be useful for its users and we need everyones feedback. This Feature is ready to use although it should be documented in a few days. Thank you everyone for giving us your input and we hope you enjoy developing with Carriots!

#10 alvaro

alvaro

    Carriots CTO

  • Administrators
  • 72 posts

Posted 19 April 2013 - 08:20 AM

Hello all.

 

We have just released a documentation page about dates in Carriots. You will find useful information and the new "now" API feature!

 

Here is the doc: "API -> Dates"

 

Enjoy Carriots!


Alvaro Everlet

Carriots CTO


#11 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 19 April 2013 - 09:03 AM

Cool docs.  I've been using now for a little bit and it helps keep my code in sync with time, and not having to deal with NTP or SNTP.  I like seeing the added parameters and may make use of them.  This time call is really great for devices with minimal resources, but still need time.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users