Timestamp for contiki - contiki

I want to add a timestamp with the data I am collecting in Contiki. When I am adding time.h from c library, it is showing that the associated files are missing. Can someone show to add the time stamp either using standard C files or using Contiki library?

You might want to have a look at core/sys/clock.h. It might not provide a date and time but at least you will get the seconds since startup.

it is better to output the data to python and there it is possible to add timestamp(month and date)

I had a similar requirement in my project. I did the following.
Use microcontroller RTC to get date and time
Convert that into Unix timestamp. If you just google you can find simple C code for converting date and time into Unix timestamp.
Send timestamp with payload, my payload is in json format so I use a key to distinguish from other data.
Hope this helps.

Related

An Efficient Way to Load and Update Data from Parse (iOS)

I want to fetch data from Parse and save/load data from local databases without using Parse pin/unpin features due to some needs. I have a timestamp db (has a column called dbname, and a column called timestamp) and a actual db for data on both local and Parse. And my app will first compare the timestamp on local with Parse. If the timestamps are different, then my app will update the local DB. My questions are that: Is this a correct way to improve app's performance (i.e. reduce loading time, any demos on github?)? Where should I implement this? Should I do it in app delegate or in the first view controller? What will the most efficient way to do this? Is there any other ways to do this?
You must have to read this Apple iOS developer library
from the Set up Set Up
Try to understand the architecture of the iOS app.

Is there any API for converting Address to Timezone offset

Is there a API available for converting Address to Timezone?
I have an idea of using Google GEOCODE API for converting Address to LAt long and then Timezone api to convert it into timezone.
Is this is a viable option? Has anyone done this in past?
Do we have any other options?
There's always askgeo.com. They do exactly what you are looking for.
Also, this question was previously answered here
SmartyStreets will return lat/long and time zone data for United States addresses, all in one step. You can do this via API or a list upload. Just keep in mind that time zone data can change, so you would need to update your data every once in a while to keep up with those changes (if you're planning on keeping some sort of database, etc.)
Another thing to be aware of is Daylight Savings Time observance, which SmartyStreets also indicates in its returned data. You can see a full list of our output fields here.
(Disclosure: I work at SmartyStreets)
Update - 11 Jan 2016: SmartyStreets now processes international addresses.

Is there a way to determine the actual time and date in iOS (not the time of the device)

In iOS, I need to know the actual time (UTC), not the time of the device. In other words, it should not be possible for the user to tamper with the time or date.
Anything that requires a network connection is not good (so accessing a time server is not an option).
AFAIK, there are 2 theoretical ways of achieving this:
Use the timestamp from the GPS satellite signal
Get the current time from the carrier
Problem is that this information is not exposed by any API in iOS.
Is there another way?
Most solutions you could possibly find (including getting GPS data from CoreLocation to access the time information) are flawed because they are depending on the actual device to access time time. You will need to connect to a time server (i would suggest to check for NTP server). I was looking at the core telephony framework and couldn't find anything that would provide the network time. You might want to fill a bug report and request apple to expand one of the classes to include the time.
You could have a look at secondsFromGMTForDate: and secondsFromGMT in NSTimeZone. If the GMT offset increases/decreases when the time of the device is changed, these provide a way to correct your timestamps to GMT (and probably convert to UTC).
You can't get to the raw GPS data and the timestamp property of the CLLocation in locationManager:didUpdateLocations: is set with the system clock

Time Zone Calculation

Am developing website like online travel portal. The issue is displaying GMT time for various regions at flight booking and list out the timing. Any one gives idea to calculate and show the time for different countries?
Thanks
Although it is pretty hard to answer your question without a reference to particular technology, I will try.
End user Time Zone detection
Definitely, all time-related information should be presented both in local format and local time zone. By local I mean the one used by end user.
I am guessing that your application will not require creating user profiles. I am also assuming that flight schedules will not be visible on front page and user would need to perform search. In that case you have three choices:
Let user specify time zone from drop down box. I have no way to show you how it should be done without referring to concrete technology. The only thing I must point out is, it should present UTC offset, time zone name and list of cities, for example: UTC+01:00 Central European Time (Paris, Berlin, Warsaw).
You could read current time zone offset with JavaScript and send it out to server
In that case you can use following code snippet to detect offset:
var now = new Date();
var offset = now.getTimezoneOffset();
This will give you current GMT offset in minutes. The problem with that solution is, this offset might be different on the target date.
Obviously you could as well send GMT based dates in invariant form to the browser (for example using ISO8601 format: 2011-05-25T11:07Z) and format this date on the client using JavaScript. I never heard of for example JQuery plugin which would do that correctly (respecting local formats), though. It seems that you would be forced to write your own.
Date and time formatting as well as time zone conversion
Ha, it depends on solution you want to implement as well as technology you want to use. For now, I can't write much here.

Web application date time localization best practice at 201x

I have worked for various web projects but correct date time localization have not been done and considered throroughly so I want to ask this very typical problem here and I want to hear comments from expert in this problem
What is the correct strategy for storing a date/time value from client from server
As I understand, because of locale and timezone so we have to do the conversion, I have heard about GMT or UTC time and after do some search it seems that UTC is more accurate ? so we will convert from client time -> UTC+0 when saving and when we read the value from server to client, we convert from server time back to client time again ?
However, I see in some website, at the bottom have the sentence "All times are in UTC", "All times are in GMT" and also "All times are in your local time". So maybe not all the sites do the convertion back and forth ? And in that case the user has to manually do the date/time conversion ?
How to display the date/time convenient to user based on his locale and region
How to provide personalization on date/time value ? I had one time depends on vbscript to do the display and the format is read from windows regional and format settings automatically. But without vbscript how can we determine a date/time pattern for a user of a specific locale. Do we have to store a mapping between a locale and pattern somewhere and do the conversion at the server side ?
Although date/time conversion is needed in most case, there's situation where only date matter for example if my birthday is 2 Feb 1980, it should be the same for all locale and no conversion should be done. How can we address this issue.
Storing the dates in UTC is always better. While displaying to user, convert it to local time and display

Resources