timespec

Is there a standard way to convert a struct timeval into a struct timespec?

struct timeval represents and instant in time with two members, tv_sec (seconds) and tv_usec (microseconds). In this representation, tv_usec is not by itself an absolute time it is a sub second offset off of tv_sec. struct timespec works the same way except that instead of microseconds it's offset (tv_nsec) is stored in nanosecond units...

Is timespec not defined in Windows?

It seems weird to me that this answer is hard to find. I've included time.h and ctime, but vc9 is still complaining about an undefined type 'timespec'. I've searched here, MSDN, and the web (even with the exact compiler error), but I can't find the answer... maybe it's just lost in the noise. Here's the exact error: error C2027: use o...

Perl module for parsing natural language time duration specifications (similar to the "at" command)?

I'm writing a perl script that takes a "duration" option, and I'd like to be able to specify this duration in a fairly flexible manner, as opposed to only taking a single unit (e.g. number of seconds). The UNIX at command implements this kind of behavior, by allowing specifications such as "now + 3 hours + 2 days". For my program, the "n...

How to retrieve file times with nanosecond precision?

I've just discovered that the stat() call, and the corresponding struct stat, does not contain fields for the file times with precision greater than one second. For setting these times, there are a variety of {f,l}utime{n,}s() functions, but not for getting. How then does obtain these times with nanosecond precision, preferably using PO...