diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 0a6df786829ea23f212b2e0a0651e4679c9c0388..d2e8c6ad4656c438c6ab3bffbf30b4ab99dd8a20 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -1503,6 +1503,7 @@ void *UE_thread(void *arg) {
   int i;
   int th_id;
   static uint8_t thread_idx = 0;
+  int ret;
   cpu_set_t cpuset;
   CPU_ZERO(&cpuset);
 
@@ -1724,15 +1725,27 @@ void *UE_thread(void *arg) {
           }
 
           pickTime(gotIQs);
-          struct timespec tv= {0};
-          tv.tv_nsec=10*1000;
 
-          if( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM)
-            tv.tv_sec=INT_MAX;
+          /* no timeout in IS_SOFTMODEM_BASICSIM or IS_SOFTMODEM_RFSIM mode */
+          if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM) {
+            ret = pthread_mutex_lock(&proc->mutex_rxtx);
+          } else {
+            struct timespec tv;
+            if (clock_gettime(CLOCK_REALTIME, &tv) != 0) {
+              perror("clock_gettime");
+              exit(1);
+            }
+            tv.tv_nsec += 10*1000;
+            if (tv.tv_nsec >= 1000 * 1000 * 1000) {
+              tv.tv_sec++;
+              tv.tv_nsec -= 1000 * 1000 * 1000;
+            }
+            ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv);
+          }
 
           // operate on thread sf mod 2
-          if (pthread_mutex_timedlock(&proc->mutex_rxtx, &tv) !=0) {
-            if ( errno == ETIMEDOUT) {
+          if (ret != 0) {
+            if (ret == ETIMEDOUT) {
               LOG_E(PHY,"Missed real time\n");
               continue;
             } else {