LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-13-2007, 08:55 AM   #1
Jayaraghavendran
LQ Newbie
 
Registered: Feb 2006
Posts: 16

Rep: Reputation: 0
Function similar to LocalFileTimeToFileTime in Linux!


Hi,

There is a function names LocalFileTimeToFileTime in Windows which converts a local time to a file time based on the coordinated universal time.

Is there a similar function available in Linux or Linux flavour Operating Systems?

Can we implement the same? If somebody has a sample implementation, please post it.

Thanks in Advance!

Regards,
Jay
 
Old 07-13-2007, 12:52 PM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
If I guess correctly what the Windows function is for, it is unnecessary and inapplicable for *nix systems. For *nix systems, file modification/access times are stored on disk as the number of non-leap seconds since the midnight at the beginning of 1 January 1970 UTC. It is only when they are displayed that the info is converted to local time (and broken down into year/month/day/hour/minute).

You can cause the ls command to display modification times in different time zones (including UTC, as in this example) thus:

Code:
wally:~/test1$ date
Fri Jul 13 10:51:02 PDT 2007
wally:~/test1$ ls -l
total 0
-rw-------    1 wally    wally           0 Jul 13 10:51 typescript
wally:~/test1$ export TZ=UTC
wally:~/test1$ date
Fri Jul 13 17:51:14 UTC 2007
wally:~/test1$ ls -l
total 0
-rw-------    1 wally    wally           0 Jul 13 17:51 typescript
wally:~/test1$ unset TZ
wally:~/test1$ date
Fri Jul 13 10:51:20 PDT 2007
wally:~/test1$ ls -l
total 0
-rw-------    1 wally    wally           0 Jul 13 10:51 typescript
wally:~/test1$
But notice that this affects not only the ls command, but practically everything that displays some form of date/time, including the date command.

Hope this helps.
 
  


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
have objectdock similar in linux ? LinxNew Linux - Software 3 02-25-2006 09:29 AM
anything similar to analogx in linux ? majalee Linux - Networking 0 02-14-2005 01:29 AM
Perl exec function in linux (and system-function) nazula Programming 1 04-19-2004 12:21 PM
Any games similar to these on Linux? eBopBob Linux - Games 3 02-06-2004 11:37 PM
SmoothWall for linux, or anything similar? bripage Linux - General 1 10-03-2002 09:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:38 PM.

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