Syndicate content

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.

  • CD-ROM
  • IsNull

    The Visual Basic function to check whether a value is set to Null. The PHP equivalent is is_null().

  • nop

    nop is the usual abbreviation for the No Operation command often used in assembly language (processor code.) Some times, it is written as noop instead.

  • reboot

    The action of restarting a computer is called reboot. This reloads the operating system and your different auto-start software.

    There are two types of reboots: a cold reboot and a warm reboot.

    The cold reboot is the one where you turn your computer all the way off and back on. It is considered to be the ultimate reboot which ensures that everything is alright.

    The warm reboot is when you just reboot your operating system. This means some of the hardware parts may not be fully reset as expected in a cold reboot. There are several reasons for this, at times the BIOS of your system does not give the correct signals to all the parts, and at times the signal doesn't propagate to all the parts as it should.

    This is why a warm reboot does not always work (i.e. think when you change a driver and the new driver is not able to properly reset the state of a board or chip... turning the computer all the way off and back on may resolve the problem.)

  • shipping