mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
🔥 "#include <chrono>"
This commit is contained in:
parent
5f74e0ce12
commit
09408ae800
1 changed files with 8 additions and 10 deletions
18
main.cpp
18
main.cpp
|
|
@ -1,5 +1,4 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <chrono>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -94,15 +93,14 @@ int main(int argc, char **argv)
|
||||||
const unsigned long saving_freq = std::stoul(std::string(argv[2]));
|
const unsigned long saving_freq = std::stoul(std::string(argv[2]));
|
||||||
if (saving_freq) //if saving frequency is 0 then auto saving is turned off
|
if (saving_freq) //if saving frequency is 0 then auto saving is turned off
|
||||||
{
|
{
|
||||||
std::thread([saving_freq]()
|
std::thread([saving_freq]() {
|
||||||
{
|
while (1)
|
||||||
while (1)
|
{
|
||||||
{
|
std::this_thread::sleep_for(std::chrono::minutes(saving_freq));
|
||||||
std::this_thread::sleep_for(std::chrono::minutes(saving_freq));
|
std::cout << "Saving " << std::time(0) << "...\n"
|
||||||
std::cout << "Saving " << std::time(0) << "...\n"
|
<< Bank::Save();
|
||||||
<< Bank::Save();
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
} //destroying setup variables
|
} //destroying setup variables
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue