cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
UNIX/Linux Programming
getting time stamp in micro or milli scr
getting time stamp in micro or milli scronds
Apr 24, 2009 at 1:49pm UTC
vijkrr
(86)
hi
I want to get the file creaton times in micro or milli seconds. Can any one help me in how to get it using a C++ program?
Apr 24, 2009 at 1:55pm UTC
Bazzy
(6281)
Try with 'clock' from ctime
http://www.cplusplus.com/reference/clibrary/ctime/clock/
eg:
1
2
3
clock_t before = clock();
//create your file
clock_t result = clock() - before;
The result can be in micro or milliseconds, to know that see the value of CLOCKS_PER_SEC
Apr 24, 2009 at 3:46pm UTC
vijkrr
(86)
Hi Bazzy..
Thanks for ur reply..
But I'm not creating the file, i want only the timestamp of the already existing files through my C code..
Apr 24, 2009 at 4:34pm UTC
PanGalactic
(1658)
glibc has
st_ctimensec
(ctime nanoseconds) as part of
struct stat
. Most filesystems don't keep file times that accurately. And I have no idea how portable it is.
Topic archived. No new replies allowed.