3

I just wanted to use nanosleep() but it seems not to be available in MingW ctime:

#include <ctime> //this is what I need, isn't it?

How can I use nanosleep on MingW? Thanks.

blubberbernd
  • 3,641
  • 8
  • 35
  • 46
  • 1
    You could alternatively see if usleep is in unistd.h – Erik Apr 11 '11 at 08:39
  • The code I have uses usleep() already. But I read that nanosleep() is better, so I wanted to use it instead of usleep (all the static analyzers throw warnings and usleep is declared as obsolete and there are also some articles on the web about it). – blubberbernd Apr 11 '11 at 08:41

2 Answers2

1

Unfortunately, MinGW doesn't provide nanosleep().
MinGW only provides functions on this list, which are in the Microsoft API.

Ben Stott
  • 2,218
  • 17
  • 23
1

In standard C++ library there is no such function (nanosleep). It is POSIX specific function declared in <time.h> not in <ctime>. You are under windows. Windows isn't POSIX. If you want to use POSIX library you need to install Cygwin.

UmmaGumma
  • 5,633
  • 1
  • 31
  • 45