Questions tagged [timespec]

'timespec' is a structure allowing to store the time since Epoch (1. Jan 1970) providing nano seconds along with seconds. It is a POSIX extension to the C Standard to be declared in ''.

36 questions
0
votes
1 answer

How to correctly convert timespec to timeval?

I have a struct timespec object I need to convert to struct timeval for use with lutimes(...). I've attempted the following, but lutimes() complains. const struct timespec ts; // originally provided as function parameter from FUSE struct timeval…
Cobra_Fast
  • 15,671
  • 8
  • 57
  • 102
0
votes
2 answers

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…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
0
votes
2 answers

stat.h file access file descriptors open() Hacking The Art of Exploitation

I am working out of the 2nd edition of Jon Erickson's "Hacking: The Art of Exploitation" using a VM (virutalbox) to run the LiveCD it came with (Ubuntu 7.04). In section 0x281 "File Access", the author explains accessing files through file…
user1234
  • 21
  • 4
-1
votes
1 answer

Subtraction of long in C loses precision?

I'm sure the answer is simple, but I don't quite get it. I'm trying to calculate the delta between two struct timespec using this code: struct timespec start, finish, diff; int ndiff; /* Structs are filled somewhere else */ diff.tv_sec =…
gmolau
  • 2,815
  • 1
  • 22
  • 45
-1
votes
1 answer

struct timespec in struct

The following is one minimal example to reproduce the problem. To me, the code looks quite innocent. I suspect there's some magic behind struct timespc; however, I can't find anything that could explain why it crashes. #include #include…
Albert Netymk
  • 1,102
  • 8
  • 24
-5
votes
1 answer

Addition between Integer and Float.... resulting in a Zero

I have been doing an operation in C++ on the timer struct of Linux provided by the interface "clock_gettime(CLOCK_MONOTONIC, &CurrentTime)" #include #include int main() { struct timespec CurrentTime; CurrentTime.tv_sec…
AYZAB
  • 5
  • 3
1 2
3