The Linux Page

How do you get micro-seconds from the Linux stat(2) call?

A little while ago I noticed that I couldn't find documentation on how to get the modification time of a file in micro-seconds. The notorious stat() call returns st_mtime defined as a time_t in the documentation.

Well... The fact is that the structure is really composed of a timeval structure and not a time_t (that applies to all 3 time values: modification, last access, and last status change.) So in fact you can use the name of the field without the last letter and a sub-timeval field as in:

struct stat s;
seconds = s.st_mtim.tv_sec; // == s.st_mtime
microseconds = s.st_mtim.tv_usec;

Strange that the documentation does not even mention the fact in the Linux documentation...

Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

     

Terms of Site Index

Find the page/content you are looking for with our index.

  • CSS

    CSS stands for Cascading Style Sheets. The sheets are used to describe the display of your HTML data. It is primarily used in Browsers, although some Graphical Interfaces are starting to make use of basic properties of the CSS. The basics are quite similar to the X11 resources.

  • FTP
  • Internet Explorer

    Internet Explorer is the browser offered by Microsoft to browse your file system and the Internet. It is based on the old free software called Mosaic. Now it is borrowing parts of other free software such as Konqueror. It first used Visual Basic as a language, now it supports Javascript very well too. It was a great browser in competition with Netscape 5.x from the start (trying to undermine the company named Netscape.)

  • toolbar
  • views

    A module Drupal that let people define lists of nodes, blocks, feeds, and whatever other data available in your Drupal installation.