mc-Things

General Category => mc-Things General Discussion => Topic started by: bdevlin on April 12, 2017, 01:37:07 pm

Title: TimeStamps
Post by: bdevlin on April 12, 2017, 01:37:07 pm
Does anyone have a GetTime() functions of sorts. Perhaps we can use the various cloud time servers. I don't know how to do it though. I know I can just stamp the data as it streams into my MQTT server, but I am just toying with a few options.

Thanks,
Brad
Title: Re: TimeStamps
Post by: mc-John on April 15, 2017, 05:27:47 pm
I don't understand what you are asking but the gateways get their time from the specified SNTP server and the devices get their time from the gateway every 24 hour.
Title: Re: TimeStamps
Post by: bdevlin on April 15, 2017, 05:43:36 pm
Well, basically, what is the time stamp variable for my  script when it transmits data from the module. I'm not aware I can add code that executes from the gateway to fetch that timestamp, in my mobile script. If I need to get the transmission datetime  from a receiver,  rather that a module, that's fine. I just don't see if it's possible or not.
Title: Re: TimeStamps
Post by: mc-John on April 18, 2017, 10:22:37 am
You can get the time from the module "DataTime.Now()", which is updated by the gateway daily, and add that to your message. Would that work?
Title: Re: TimeStamps
Post by: bdevlin on April 20, 2017, 03:37:21 pm
That's what I need thanks. There is also a comprehensive parsing example in the MQTT section from another member I may need to borrow script from.
Title: Re: TimeStamps
Post by: Nick_W on May 20, 2017, 01:32:29 pm
My Time library has this function in it:

Code: [Select]
Shared Function GetTimestamp(format As TIME_FORMAT, TimestampOffset As Integer) As String
used for unix type time stamps. Might do what you want...