I want to sleep in milliseconds

Asked 2 years ago, Updated 2 years ago, 156 views

I know that the sleep(x) function of C++ POSIX is sleep in seconds I want to do sleep in milliseconds, but is there a function like this?

linux c++ sleep

2022-09-21 16:49

1 Answers

Depending on the platform

#include <unistd.h>

int main(){
    unsigned int microseconds;
    usleep(microseconds);
}
#include "stdafx.h"
#include "windows.h"
#include "iostream"
using namespace std;
int main(){
    int x = 6000;
    Sleep(x);
    return 0;
}


2022-09-21 16:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.