Added missing file manual to repo
This commit is contained in:
56
bc.cpp
Normal file
56
bc.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QApplication>
|
||||
#include <QChar>
|
||||
|
||||
#include <bc.h>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
namespace bc
|
||||
{
|
||||
|
||||
void delay_seconds( uint32_t tval )
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::seconds( tval ) );
|
||||
}
|
||||
|
||||
|
||||
void delay_millis( uint32_t tval )
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds( tval ) );
|
||||
}
|
||||
|
||||
|
||||
void delay_micros( uint32_t tval )
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::microseconds( tval ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Macht aus int x den String 000x zum schönaussehen.
|
||||
* @param count der Wert
|
||||
* @param len die voranzustellenden Nullen
|
||||
*
|
||||
* Macht aus int x den String 000x zum schönaussehen.
|
||||
*
|
||||
*/
|
||||
|
||||
QString formatInt( int count, int len )
|
||||
{
|
||||
QString result( "%0" );
|
||||
result = result.arg( count, len, 10, QChar( '0' ) );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void processEventsFor(int milliseconds)
|
||||
{
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
|
||||
while (timer.elapsed() < milliseconds) {
|
||||
QApplication::processEvents(QEventLoop::AllEvents, 50);
|
||||
}
|
||||
}
|
||||
} // namespace cbc
|
||||
Reference in New Issue
Block a user