mirror of
https://github.com/thiagoralves/OpenPLC_v3.git
synced 2026-08-18 11:41:13 +08:00
Fixed long sleep, over 1s.
This commit is contained in:
@@ -62,11 +62,12 @@ void glueVars()
|
||||
|
||||
void updateTime()
|
||||
{
|
||||
__CURRENT_TIME.tv_nsec += common_ticktime__;
|
||||
__CURRENT_TIME.tv_sec += common_ticktime__ / 1000000000;
|
||||
__CURRENT_TIME.tv_nsec += common_ticktime__ % 1000000000;
|
||||
|
||||
if (__CURRENT_TIME.tv_nsec >= 1000000000)
|
||||
{
|
||||
__CURRENT_TIME.tv_nsec -= 1000000000;
|
||||
__CURRENT_TIME.tv_sec += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ extern int ignored_int_inputs[];
|
||||
extern int ignored_int_outputs[];
|
||||
|
||||
//main.cpp
|
||||
void sleep_until(struct timespec *ts, int delay);
|
||||
void sleep_until(struct timespec *ts, long long delay);
|
||||
void sleepms(int milliseconds);
|
||||
void log(unsigned char *logmsg);
|
||||
bool pinNotPresent(int *ignored_vector, int vector_size, int pinNumber);
|
||||
|
||||
@@ -53,9 +53,10 @@ int log_counter = 0;
|
||||
// Helper function - Makes the running thread sleep for the ammount of time
|
||||
// in milliseconds
|
||||
//-----------------------------------------------------------------------------
|
||||
void sleep_until(struct timespec *ts, int delay)
|
||||
void sleep_until(struct timespec *ts, long long delay)
|
||||
{
|
||||
ts->tv_nsec += delay;
|
||||
ts->tv_sec += delay / (1000*1000*1000);
|
||||
ts->tv_nsec += delay % (1000*1000*1000);
|
||||
if(ts->tv_nsec >= 1000*1000*1000)
|
||||
{
|
||||
ts->tv_nsec -= 1000*1000*1000;
|
||||
|
||||
Reference in New Issue
Block a user