LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-29-2010, 04:44 AM   #1
3logy
LQ Newbie
 
Registered: Dec 2010
Posts: 10

Rep: Reputation: 0
[kernel Programming] Convert timespec to Datetime


Hi people,

i have a little question!!

i'm changing some syscalls functions into kernel 2.6.36.2
So i'm doing this :
Code:
  struct inode * inode;
  struct dentry * dentry;
 
  dentry = path.dentry;
  inode = dentry->d_inode;

  printk( "Date %i \n", inode->i_atime );

But i have a output like this : Date 1293619251

How can i convert inode->i_atime into D:M:Y h:m Format?? or just simply D:M:Y

Thanks
 
Old 12-30-2010, 09:41 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
That's what is called a timestamp - it's the number of seconds since the midnight on the 1st January 1970.

You can use the ctime function in time.h to convert it to a char* array, which can be manipulated into the format you want
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mktime adds hour unless extra timespec pointers declared halestorm914 Programming 3 12-03-2010 11:34 AM
[SOLVED] Simple Linux script to convert datetime format to UTC format shayno90 Linux - Newbie 10 10-09-2009 08:19 AM
Convert timeval to timespec ranthal Linux - Kernel 3 07-06-2009 06:31 PM
Using struct timespec from time.h pd9 Linux - Kernel 0 07-26-2008 04:56 PM
Convert Time String to DATETIME field Centinul Programming 2 09-25-2006 07:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:44 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration