How do I approach this problem


I need to know if this is string or char or int etc.

I want to get an int out of the number of minutes cause I need to separate those for this clock I am making.

I assume they are in char because they serial.print ok.

But where do I find the location of the actual data item in the .cpp that uses it?


timeClient is an instance of ...what?

(There's a reason we ask you not to post snippets. Thank you for highlighting it)

Well all i know is that it gets the time from or something. I searched my mac for the snippet and could not find the proper .h file that owns it.

That's part of my question, how do i even find the program that uses it. The next part is finding the data type.

These are the includes.
#include <NTPClient.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <stdlib.h>
NTPClient timeClient(ntpUDP, "", utcOffsetInSeconds);

then you have this
void setup() {


WiFi.begin(ssid, password);

while ( WiFi.status() != WL_CONNECTED ) {
delay ( 500 );
Serial.print ( "." );



void loop() {
Serial.print(", ");

NTPClient timeClient(ntpUDP, "", utcOffsetInSeconds);

I don't know a great deal about Macs, but a search like "find . -name "*.h" | xargs grep "NTPClient" -l"is going to get you some useful filenames.
Then you've got to go digging.

Or find a useful Apple-compatible cross-reference package.

Don't know where to find that file on your computer (especially the way things are hidden on MACs), but this is the library with that name that pops up in Library Manager: GitHub - arduino-libraries/NTPClient: Connect to a NTP server.

As I stated in your previous thread, the .h file contains the class's interface. So, open that file on the GitHub page and all will be revealed. You'll find the signatures for all class member functions.

I assume they are in char because they serial.print ok.

The Print class contains a series of function overloads for print() that allow it to take any of the common data types as an argument so this is no indication of it being char.

But where do I find the location of the actual data item in the .cpp that uses it?

One trick for easily finding library source files:

  • File > Examples > {library name} > select any example
  • Sketch > Show sketch folder

This will open the folder that contains the example sketch, which is inside the library's folder. The source files will either be in the root of the library folder or under the src subfolder of the library's root folder.

A more hacky way is to deliberately cause an error by passing arguments to the function that you know it doesn't support. This function call:


produces this helpful error:

Basic:25:33: error: no matching function for call to 'NTPClient::getMinutes(const char [7])'



In file included from C:\Users\per\AppData\Local\Temp\arduino_modified_sketch_231364\Basic.ino:1:0:

E:\electronics\arduino\libraries\NTPClient/NTPClient.h:63:9: note: candidate: int NTPClient::getMinutes()

     int getMinutes();

try a couple different casts if your function is returning a string you can use .toInt();

one of these should work. did you see if it is allready an int?

int n = timeClient.getHours();

if it is outputting a string then this would work

int n = timeClient.getHours().toInt();

if it is a character array then something like this would work

String s = (String)timeClient.getHours();

int n = s.toInt();