LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 09-28-2009, 10:43 PM   #1
grinderr
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Rep: Reputation: 0
setting system time from embedded application


I need to be able to set the system time from with in my embedded application. I am writing an app using Sourcery_G++ with the target being an phytec 3250 ARM9 running embedded Linux kernel 2.6.26. I know that I can set the system time from the command prompt using "date 092819402009" but what is the similar function calls from within an application?

thanks
 
Old 09-29-2009, 06:00 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Look at stime(2).
 
Old 10-06-2009, 09:22 AM   #3
grinderr
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Original Poster
Rep: Reputation: 0
setting system time

I tried using mktime() to set the system time from my embedded application, but it doesnt persist. I also have looked at stime(2), but from the documentation it doesnt appear that is the right way to go. I was looking at sys_clock_settime(), can anyone tell me about the usage of this routine from an embedded application?

thanks
 
Old 10-06-2009, 05:58 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
mktime() sets the operating system time. sys_clock_settime() allows the setting of an in-kernel clock, but it still won't set the hardware time. For hardware time, you need to look at something like hwclock.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
hardware clock time differs from system time after setting maxgsp Linux - Software 2 02-28-2009 07:15 AM
hardware clock time differs from system time after setting maxgsp Linux - Hardware 1 02-27-2009 05:24 AM
Need Information regarding real time embedded linux operating system insha Linux - Newbie 2 06-12-2007 07:36 AM
setting the system time mbdyson Linux - Software 1 03-07-2006 03:00 PM
Setting System Time: kernel in wrong time zone warrenweiss Linux - General 7 05-15-2004 03:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 11:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration