Include <library> vs "library"

What is the difference between #include and #include “library”?
I downloaded the sketch below and wanted to examine the library time.h to find out what the output variable types are but couldn’t find the library.
When I hover over it, it gives the location as:
AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\tools\sdk\esp32\include\newlib\platform_include\time.h

In that folder there are none of the usual entries such as examples or a .cpp file.

#include <WiFi.h>
#include "time.h"

const char* ssid = "SSID"; // Name of the Wi-Fi box
const char* password = "Password"; // MDP of the Wi-Fi box

const char* ntpServer = "pool.ntp.org";
const long gmtOffset_sec = 3600 * 0;
const int daylightOffset_sec = 3600 * 0;
float seconds;
void setup() {
Serial.begin(9600);
delay(1000);

WiFi.mode(WIFI_STA); // Optional
WiFi.begin(ssid, password);
Serial.println("\nConnecting");

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

Serial.println("\nConnected to the WiFi network");
Serial.print("Local ESP32 IP: ");
Serial.println(WiFi.localIP());

// We configure the NTP server
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
}

void loop() {
struct tm timeinfo;
if (!getLocalTime(&timeinfo)) {
Serial.println("Failed to obtain time");
}
Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");

//seconds = atoi(&timeinfo, "%S");

delay(1000);
}

You could find the answer yourself in Google in one minute, I just entered your question there

If you use < and > round the name of the library file then the compiler will search the standard library locations for it

If you use " and " round the name of the library file then the compiler will look for it first in the folder that the sketch is in

It depends on the system involved, some limit the library search paths differently, some just impose a different search order. IIRC Arduino does the search order thing, so that if there's only one match it will always find it.

Use <> for external libraries, "" for one's local to your application (in the same source tree). That way your intention is documented too.

With verbose output you can see which library directories are passed to the compiler in the command lines.

Thanks for that. I did do the search but included the word Arduino.

I've only been experimenting with Arduinos for about a month and am still unsure on a lot of things.

If an article refers to C or C++, will this generally also be relevant to Arduinos? I’m not clear on the overlaps and exceptions.

The language that Arduino ecosystem uses is generally C++ with custom classes and libraries.

I have to admit that this is all going over my head at my current level of understanding.

I have however managed to dig out an old post which has helped me achieve what I wanted to do. The post is help using the time library on ESP32

I can find the constituent parts of the time with

timeinfo.tm_sec

etc.

For a beginner, the most useful part of a library is a really good Readme file in the library folder. I can’t find one though for the time.h folder.

Thanks for every bodies help.

On ESP32, 'time.h' is pretty much a straight implementation of the standard Unix / POSIX Time functions, data types, and structures that have been around since at least the 1980s. So, you may not find much information in Arduino-centric sources, but it's out on the interweb in more general form.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.