473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to obtain current date and time with milliseconds in a Embedded C program?

I am trying to obtain current date and time with milliseconds in an Embedded application using C programming language in Kiel compiler. can any one suggest how can I do this.
Jan 18 '11 #1
4 5504
Banfa
9,065 Expert Mod 8TB
That entire depends on if the platform you are using has a real time clock and if it does the resolution of that clock and the interface used to read it.
Jan 18 '11 #2
donbock
2,426 Expert 2GB
To elaborate on Banfa's answer: there is no Standard C Library function that is guaranteed to give you current date and time with millisecond resolution.

You either need to make use of the details of how your platform supports implementation-dependent features of the <time.h> functions or you need to make use of nonstandard functions provided by your platform.

Does the hardware of your embedded system have a millisecond-resolution clock/timer?
Jan 19 '11 #3
Banfa
9,065 Expert Mod 8TB
Elaborating further plenty of embedded platforms have no real time clock at all particularly in the default implementation so the standard library supplied with the compiler can't even support the standard functions in time.t such as time_t time ( time_t * timer ); which returns the current time in seconds since 1/1/1970 00:00:00.

Most micro-processors include no real time clock, if one exists on the platform then it is normal additional hardware (in the form of a real time clock chip with crystal) so the standard library for the micro-processor can have no prior knowledge of it.

On the other hand if you just need to measure elapsed time pretty much all micro-processors have a timer interrupt and some have several allowing you to measure time in terms of some multiple of the micro-processors clock frequency.
Jan 19 '11 #4
horace1
1,510 Expert 1GB
I tend use something like a FM33256 which has a RTC (real time clock) and SRAM which would suit most applications
http://www.ramtron.com/products/inte...duct.aspx?id=1

I have also used a GPS receiver to get the current time
However, real time accruracy to a millisecond is non trivial - do you need it to be so accurate?
Jan 19 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: vishal | last post by:
i want to store the date and time when the user registered i.e. the record is entered in my table. so how can i achieve this???? should i use php or mysql to achieve this?? which is more...
2
by: toedipper | last post by:
Hello, I have the following section of php code which updates a mysql record from a form. For the values of livedate and livetime I need to insert the current_date() and current_time()...
2
by: mattmerc | last post by:
Hi, I would like to have a date_last_modified field for one of my SQL tables. Instead of coding my front end to keep up with this field is there a way to user a formula for this column in...
5
by: Jim Heavey | last post by:
2 questions... The documentation shows a "property" call Now, which returns the current date and time, but it is not valid for how I am using it. If you declare a field as a DateTime, but...
1
by: George LAZAR | last post by:
how can I change the system current date (time) using c#? thank you George
2
by: rpboll | last post by:
Is there a function that stamps the FISCAL Date (Starting from October)? I am trying to generate a Fiscal Date and an AutoNumber for a key field. Thanks for any suggestions. RBollinger
3
by: William Cruz | last post by:
Is there a way to get the current date / time on a remote PC? William *** Sent via Developersdex http://www.developersdex.com ***
6
by: trytobreak | last post by:
Hi All, I am a network administrator in a fairly large software company and I would like to write myself a small utility, which would connect (one by one) to all machines on the network and get...
1
by: rrayfield | last post by:
Any body have an Idea on this... Last problem of my Calendar Application. To keep my calendar loading fast and efficent I have a SP that loads data to a datatable to read from c#. My sp reads...
12
by: AccessBeetle | last post by:
I have a qry bound form showing the search results based on the user entered criteria. There is a button called Edit on that form. The form is locked initally to stop user to edit any record...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.