1

Topic: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

Compilation error: no matching function for call to 'RemoteXYType_RealTimeNet::getTime()'

I am having a bit of trouble getting the time object from a RemoteXYType_RealTimeNet.

Does anyone have any pointers on how to wait until all the connections to the cloud are done and the time has been set from the NTP server (I assume that is what gets the time)

I am using the RemoteXY library 4.1.5.

Monty

2 (edited by monsteroyd 2025-11-09 18:09:19)

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

OK, I figured out I need to pass a timezone, so that is fixed.

However, I cannot get a correct date and time by using RemoteXY.realTime_01.getTime(timeZone)

realTime_01 is a RemoteXYType_RealTimeNet object.

I always get Jan 1 1970 0:0:0

I am also using this bit of code in my setup, after RemoteXY.init(), to wait until the device is connected before trying to get a time object.

  while (!RemoteXY_connectionsConfigured() == 0) {
    // keep RemoteXY communication alive while waiting
    RemoteXY_delay(200);

    Serial.print(".");

    // break out on timeout so device doesn't hang forever
    if (millis() - start >= timeoutMs) {
      Serial.println("\nWaited 20 seconds, Time sync timeout, continuing without network time");
      break;
    }
  }

Does anyone have any idea how to get a correct time from a RemoteXYType_RealTimeNet?

Is there a way to see what NTP server it is using?

Thanks
Monty

3

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

Well, until I hear how to use the datetime control to sync with NTP, etc. I am going to use the internal RTC on the Uno R4 Wi-Fi and update it using NTPClient.

This might just be easier.

Here is how I am setting up:

// Define NTP Client - use the standard WiFiUDP interface
WiFiUDP ntpUDP;
// Example: EST (GMT-5) offset, update every 60 seconds
NTPClient timeClient(ntpUDP, "pool.ntp.org", -18000, 60000);

void setupTime() {
  if (!RTC.isRunning()) {
    serPrintln("RTC not running");
    return;
  }
  // Check if Wi-Fi is connected (it should be, if RemoteXY is working)
  if (WiFi.status() == WL_CONNECTED) {
    serPrintln("RemoteXY WiFi connected. Proceeding to NTP sync.");
    // Start the NTP client using the active WiFi connection
    timeClient.begin();
    if (timeClient.update()) {
      // If update is successful, set the board's internal RTC time
      unsigned long epochTime = timeClient.getEpochTime();
      // Create a DateTime object from the epoch time
      RTCTime compileTime(epochTime);
      // Set the board's internal RTC using the DateTime object
      RTC.setTime(compileTime);
      serPrintln("Time synchronized with NTP server.");
    } else {
      serPrintln("Failed to synchronize time with NTP server.");
    }
  } else {
    serPrintln("WiFi not connected. Time sync not possible.");
  }
}

// call timeClient.update(); in the loop function

this was run after the remotexy init call, so hopefully I can piggyback on that connection to the internet, since I am using the cloud.

I will keep this thread posted on the results.

Monty

Monty

4

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

ok I tried to use the remoteXY connection to get a timeClient to get the time from an NTP server.

It always fails the timeClient.update() check. It seems to always return false.

// Define NTP Client - use the standard WiFiUDP interface
WiFiUDP ntpUDP;
// Example: EST (GMT-5) offset, update every 60 seconds
NTPClient timeClient(ntpUDP, "pool.ntp.org", -18000, 60000);

void setupTime() {
  // give time to get things settled
  RemoteXY_delay(5000); // wait 5 seconds

  RTC.begin();

  if (!RTC.isRunning()) {
    logError("RTC not running");
  }
  // Check if Wi-Fi is connected (it should be, if RemoteXY is working)
  serPrintln("wifi status =", (int)WiFi.status());
  elapsedMillis wifiWaitTime;
  while (WiFi.status() != WL_CONNECTED) {
    RemoteXY_delay(2);
    if (wifiWaitTime > 30000UL) {
      logError("Timed out Waiting 30 seconds for WiFi");
    }
  }
  if (WiFi.status() == WL_CONNECTED) {
    serPrintln("RemoteXY WiFi connected. Proceeding to NTP sync.");
    // Start the NTP client using the active WiFi connection
    timeClient.begin();
    elapsedMillis tout;
    while (timeClient.update() == false) {
      RemoteXY_delay(2);
      if (tout > 30000UL) {
        logError("timed out waiting 30 seconds for NTP sync");
        return;
      }
    }
    if (timeClient.update()) {
      // If update is successful, set the board's internal RTC time
      unsigned long epochTime = timeClient.getEpochTime();
      // Create a DateTime object from the epoch time
      RTCTime compileTime(epochTime);
      // Set the board's internal RTC using the DateTime object
      RTC.setTime(compileTime);
      logData("Time synchronized with NTP server.");
    } else {
      logError("Failed to synchronize time with NTP server.");
    }
  } else {
    logError("WiFi not connected. Time sync not possible.");
  }
}

5

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

Please read the instructions. https://remotexy.com/en/help/systems/realtime/
All you need to do is get the time using any function. If it's zero, it means the time hasn't been read from the server yet.

int readTimeFlag = 0;
void loop () {
  RemoteXY_Handler();

  if (readTimeFlag == 0) {
    RemoteXYTime time = RemoteXY.realTime_01.getTime(timeZoneMinutes);
    if (!time.isEmpty ()) {
      readTimeFlag  = 1;
      // TODO set RTC of board
      Setial.println (time.format("d MMM YYYY, HH:mm:ss"));
    }
  }
}

RemoteXY_connectionsConfigured() means that the network is configured, but it does not mean that the time has been read yet.

6

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

I got my project working, and then I updated the RemoteXY library to version 4.1.6. However, RemoteXY_connectionsConfigured() is no longer defined. So I tried the is_connected variable in the RemoteXY struct, but it is always zero.

Do I just assume that when it returns from Remotexy.init(), the connection is done and ready to use?

Monty

7

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

remotexy wrote:

Please read the instructions. https://remotexy.com/en/help/systems/realtime/
All you need to do is get the time using any function. If it's zero, it means the time hasn't been read from the server yet.

int readTimeFlag = 0;
void loop () {
  RemoteXY_Handler();

  if (readTimeFlag == 0) {
    RemoteXYTime time = RemoteXY.realTime_01.getTime(timeZoneMinutes);
    if (!time.isEmpty ()) {
      readTimeFlag  = 1;
      // TODO set RTC of board
      Setial.println (time.format("d MMM YYYY, HH:mm:ss"));
    }
  }
}

RemoteXY_connectionsConfigured() means that the network is configured, but it does not mean that the time has been read yet.

I need the RTC setup and running before I can do anything, so waiting in the loop function isn't really the place for this. I'd like to do it in the setup function so I know that any errors are logged with the correct date and time.

Did you remove RemoteXY_connectionsConfigured() from the new library? It appears to longer be available in the new 4.1.6 library.

I guess I'll have to do it this way if I can't determine if the remote xy connection is working etc.

So I'll have that check for the time, and if the time isn't ready yet, I'll add a return so the loop stays waiting for the time.

Monty

8

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

If you wait for the time from the server, your board may not turn on at all. There could be many reasons.
1) The Wi-Fi network is unavailable due to a power outage.
2) The internet is temporarily unavailable.
3) The time server is unavailable.
The best solution is to make the board independent of the real-time server. Use the previous RTC value if you have a battery.
But if you want the board to wait, the code below will help.

int readTimeFlag = 0;

void loop () {
  RemoteXYEngine.handler();

  if (readTimeFlag == 0) {
    RemoteXYTime time = RemoteXY.realTime_01.getTime(timeZoneMinutes);
    if (!time.isEmpty ()) {
      readTimeFlag  = 1;

      // TODO set RTC of board

    }
  }
  else {
    loopIfRtcWorks ();
  }
}

void loopIfRtcWorks () {

  // TODO 

}

In the new library, we're removing macros. Use RemoteXYEngine.connectionsConfigured() or, if you created a remotexy object, use remotexy->connectionsConfigured()

9

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

I changed to use the last code from RemoteXY to wait until the time object was not empty in the loop function.

I did add a timeout so it breaks out of the loop after 30 seconds of trying.

However, after I try to set the RTC clock, I get 2026-02-02T06:22:15

Here is the code I am using to set the RTC clock on the UnoR4

void setBoardTime() {
  // Get epoch milliseconds from RemoteXY
  RemoteXYTime rxt = RemoteXY.realTime.getTime(timeZoneMinutes);
  // Construct RTCTime with all 8 arguments
  RTCTime t(
    rxt.day,                        // day
    static_cast<Month>(rxt.month),  // Month enum (1–12)
    rxt.year,                       // year
    rxt.hour,                       // hours
    rxt.minute,                     // minutes
    rxt.second,                     // seconds
    DayOfWeek::MONDAY,              // placeholder weekday, optional
    SaveLight::SAVING_TIME_ACTIVE   // DST active
  );

  RTC.setTime(t);
  serPrintln("Time synchronized with NTP server.");
}

Should I even be trying to set the R4 clock, or just use the RemoteXYTime?

Monty

10

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

ok I don't know what to do anymore.

I don't think that the time object in remotexy works. At least, it isn't enough to just check if the RemoteXYTime is empty. I get non-empty times that are either Jan 1 1970 0:0:0 or this time I got 2 Jan 2026, 06:52:44.

I think that the check should be if (time.isEmpty() != 0) instead of if (!time.isEmpty()). Not quite sure if the ! evaluates to the same as the != 0. In my program, I Serial.println the numeric value of isEmpty and then in the if (!time.isEmpty()) I have another println that never prints.

But even then a non-empty RemotexyTime object could have 1/1/1970 0:0:0

I currently have my project commented out and I am just sitting in my main loop trying to see if I can get a non empty time.
It may just loop forever and never gets a time or it gets a time that is not empty but is not correct

Here is a sample of my output

start loop===============================================
time.isEmpty() = false
************* time is 2 Jan 2026, 07:17:30

That isn't the correct time, but isEmpty = false;

11 (edited by monsteroyd 2025-11-13 19:29:41)

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

ok here is my loop function

RemoteXYType_RealTimeNet realTime;  // use .getTimeStamp(), .getTime()


void loop() {
  RemoteXY_Handler();

  serPrintln("start loop===============================================");

  RemoteXYTime time = RemoteXY.realTime.getTime(timeZoneMinutes);
  serPrintln("time.isEmpty() = ", time.isEmpty() != 0 ? "true" : "false");
  serPrintln("time.isEmpty() = ", (int)time.isEmpty());
  serPrintln("************* time is ", time.format("d MMM YYYY, HH:mm:ss").c_str());

and here is the output

 
start loop===============================================
time.isEmpty() = false
time.isEmpty() = 0
************* time is 2 Jan 2026, 07:28:45
time.isEmpty() = 0
************* time is 2 Jan 2026, 07:28:45
start loop===============================================
time.isEmpty() = false
time.isEmpty() = 0
************* time is 2 Jan 2026, 07:28:45
start loop===============================================
ad infinitum

It never gets the correct time.

12

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

What time zone did you set? Use Hour*60

timeZoneMinutes = 5 * 60; // +5:00 in minutes

13

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

remotexy wrote:

What time zone did you set? Use Hour*60

timeZoneMinutes = 5 * 60; // +5:00 in minutes

int timeZoneMinutes = -5 * 60;  // UTC-5

14

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

ok here is a test program and the output. I think the realtime member is broken.

/*
   -- testdeviceID --
   
   To compile this code using RemoteXY library 4.1.4 or later version 
   download by link http://remotexy.com/en/library/
   To connect using RemoteXY mobile app by link http://remotexy.com/en/download/                   
     - for ANDROID 4.16.02 or later version;
     - for iOS 1.13.1 or later version;
    
   To interact with the GUI, please refer to the manual: 
   https://remotexy.com/ru/help/code/interaction/

   This source code was automatically generated by the RemoteXY editor and 
   is an example for the RemoteXY library. 
   Licensed under the MIT License. See the LICENSE file in the RemoteXY library
   root (https://github.com/RemoteXY/RemoteXY-Arduino-library) for full license 
   details.             
*/

//////////////////////////////////////////////
//        RemoteXY include library          //
//////////////////////////////////////////////

// you can enable debug logging to Serial at 115200
#define REMOTEXY__DEBUGLOG    

// RemoteXY select connection mode and include library 
#define REMOTEXY_MODE__WIFI_CLOUD

#include <WiFiS3.h>

// RemoteXY connection settings 
#define REMOTEXY_WIFI_SSID "yonvaUP"
#define REMOTEXY_WIFI_PASSWORD "blackbear"
#define REMOTEXY_CLOUD_SERVER "cloud.remotexy.com"
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN "1b68e53c62137bcb6617a9d0afcfe91c"


#include <RemoteXY.h>

// RemoteXY GUI configuration  
#pragma pack(push, 1)  
uint8_t RemoteXY_CONF[] =   // 39 bytes
  { 254,1,0,0,0,1,0,0,0,28,0,20,0,0,0,0,31,1,106,200,
  1,1,2,0,1,49,49,24,24,0,2,31,0,193,42,128,20,20,3 };
  
// this structure defines all the variables and events of your control interface 
struct {

    // input variables
  uint8_t button_01; // =1 if button pressed, else =0, from 0 to 1

    // complex variables
  RemoteXYType_RealTimeNet realTime_01; // use .getTimeStamp(), .getTime()

} RemoteXY;   
#pragma pack(pop)
 
/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////

#define PIN_BUTTON_01 13



void setup() {
  RemoteXY_Init();

  pinMode(PIN_BUTTON_01, OUTPUT);

  // TODO you setup code
  Serial.begin(115200);
}

void loop() {
  RemoteXY_Handler();

  digitalWrite(PIN_BUTTON_01, (RemoteXY.button_01 == 0) ? LOW : HIGH);

  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay(), use instead RemoteXY_delay()
  RemoteXYTime t = RemoteXY.realTime_01.getTime(-5 * 60);
  if (t.isEmpty()) {
    Serial.println("\nisEmpty returned true");
  } else {
    Serial.println("\nisEmpty is false");
    static char buf[40];
    sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d",
            t.year,
            t.month,
            t.day,
            t.hour,
            t.minute,
            t.second);
    Serial.println(buf);
  }

  RemoteXY_delay(1000);
}

and here is the output

[    0.000] Debug log started
[    0.003] Add GUI
[    0.026] onnecting to WiFi: yonvaUP ...
[    0.101] Add net
[    0.108] WiFi connected
[    0.110] IP: 0.0.0.0
[    0.121] Send RealTime request...
[   10.134] RealTime request: ERROR
[   10.147] Connecting to cloud: cloud.remotexy.com 6376 ..
[   10.452] Cloud server connected
[   10.455] ->  55 2C 00 11 14 00 31 62 36 38 65 35 33 63 36 32
               31 33 37 62 63 62 36 36 31 37 61 39 64 30 61 66
               63 66 65 39 31 63 40 00 27 00 4F 54
isEmpty returned true

[   10.787] <-  55 06 00 11 31 E5
[   10.794] Cloud server registration successfully
isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

[   21.508] <-  55 06 00 10 F0 25
[   21.515] ->  55 06 00 10 F0 25
isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

[   32.771] <-  55 06 00 10 F0 25
[   32.778] ->  55 06 00 10 F0 25
isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

[   43.629] <-  55 06 00 10 F0 25
[   43.636] ->  55 06 00 10 F0 25
isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

[   54.871] <-  55 06 00 10 F0 25
[   54.878] ->  55 06 00 10 F0 25
isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

[   65.932] <-  55 06 00 10 F0 25
[   65.939] ->  55 06 00 10 F0 25
isEmpty returned true

isEmpty returned true

isEmpty returned true

isEmpty returned true

[   70.159] Send RealTime request...
isEmpty returned true

[   71.076] UTC time updated: 20406 days 77235394 millis
isEmpty is false
2026-01-03 09:30:03

isEmpty is false
2026-01-03 09:30:04

isEmpty is false
2026-01-03 09:30:05

isEmpty is false
2026-01-03 09:30:06

isEmpty is false
2026-01-03 09:30:07

[   76.771] <-  55 06 00 10 F0 25
[   76.778] ->  55 06 00 10 F0 25
isEmpty is false
2026-01-03 09:30:08

isEmpty is false
2026-01-03 09:30:09

It never returned a valid date and time. You can see it get the correct date and time from the net in the output (from Unix start). I think there is a bug in the conversion from unix getEpoch. It is a long long (int64_t) so there must be some problem or overflow in the math. Like a 32-bit overflow or something. If you look in the output it returns the correct unix epoch values for today, but it gets converted into a 2026-01-03 09:30:09 invalid date.

There is definitely a bug on your end.

Help!
Monty

15

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

Yes, we found the bug, reproduced it, and fixed it. Thank you for your persistence. The fixes will be available in the next version of the library. But for now, you can use slightly different code:

int readTimeFlag = 0;
int timeZoneMinutes = -5 * 60;

void loop () {
  RemoteXYEngine.handler();

  if (readTimeFlag == 0) {
    RemoteXYTime time = RemoteXY.realTime_01.getUtcTime();
    if (!time.isEmpty ()) {
      readTimeFlag  = 1;
      time.applyTimeZone (timeZoneMinutes);

      // TODO set RTC of board

    }
  }
  else {
    loopIfRtcWorks ();
  }
}

void loopIfRtcWorks () {

  // TODO 

}

16

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

Awesome! Thanks for the reply and fix. I look forward to the next version.

Thanks a ton
Monty

17

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

Any idea on when the new library will be released?

Monty

18

Re: Compilation error: RemoteXYType_RealTimeNet::getTime() not found

All new changes are committed to GitHub. You can test them out. New release will be released in a few days after testing.
https://github.com/RemoteXY/RemoteXY-Arduino-library
https://github.com/RemoteXY/RemoteXY-Ar … master.zip