Hi,
First of all thanks to everyone for such a great platform - I have only been working on it for a few months but its great fun and so flexible and easy to use!
I guess this is a simple (probably a NOOB) question but this has me stumped!
I am running a teensy3.2 with Arduino 1.8.13 and TeensyDuino 1.53, I am working on a project to connect to GCP IOT Core, and was producing JWT tokens successfully in my demo code using current time from a network time server.
I now want to set the internal Teensy clock with that value from the network time server which is in the format unsigned long int (date from 1970) to ensure I can re-create tokens as required without multiple time server calls.
However as soon as I started using the time functions I started to notice that time_t is defined as a long int not an unsigned long int, which is causing all kinds of problems.
Sample code to show the type:
Compile and I get:
Now I was clearly expecting the error, but is it right on this platform Teensy3.2 that time_t should be signed and not unsigned?
Hope this is an easy one to clear up - have google widely but no joy so far!
Many thanks
Tim
First of all thanks to everyone for such a great platform - I have only been working on it for a few months but its great fun and so flexible and easy to use!
I guess this is a simple (probably a NOOB) question but this has me stumped!
I am running a teensy3.2 with Arduino 1.8.13 and TeensyDuino 1.53, I am working on a project to connect to GCP IOT Core, and was producing JWT tokens successfully in my demo code using current time from a network time server.
I now want to set the internal Teensy clock with that value from the network time server which is in the format unsigned long int (date from 1970) to ensure I can re-create tokens as required without multiple time server calls.
However as soon as I started using the time functions I started to notice that time_t is defined as a long int not an unsigned long int, which is causing all kinds of problems.
Sample code to show the type:
Code:
typedef unsigned long time_t;
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Code:
sketch_mar05a:1: error: conflicting declaration 'typedef long unsigned int time_t'
typedef unsigned long time_t;
^
In file included from /Users/timteece/Work/work/Coded Cognition/Clients/Audio Wings/MK1DemoUnit/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/sys/select.h:26:0,
from /Users/timteece/Work/work/Coded Cognition/Clients/Audio Wings/MK1DemoUnit/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/sys/types.h:68,
from /Users/timteece/Work/work/Coded Cognition/Clients/Audio Wings/MK1DemoUnit/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/stdio.h:61,
from /Users/timteece/Work/work/Coded Cognition/Clients/Audio Wings/MK1DemoUnit/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Print.h:35,
from /Users/timteece/Work/work/Coded Cognition/Clients/Audio Wings/MK1DemoUnit/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Stream.h:24,
from /Users/timteece/Work/work/Coded Cognition/Clients/Audio Wings/MK1DemoUnit/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/HardwareSerial.h:252,
from /Users/timteece/Work/work/Coded Cognition/Clients/Audio Wings/MK1DemoUnit/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/WProgram.h:46,
from /var/folders/tt/jlz51f3j4j1cvw7b_kvkf0gr0000gp/T/arduino_build_176998/pch/Arduino.h:6:
/Users/timteece/Work/work/Coded Cognition/Clients/Audio Wings/MK1DemoUnit/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/sys/_timeval.h:40:18: note: previous declaration as 'typedef long int time_t'
typedef _TIME_T_ time_t;
^
conflicting declaration 'typedef long unsigned int time_t'
Now I was clearly expecting the error, but is it right on this platform Teensy3.2 that time_t should be signed and not unsigned?
Hope this is an easy one to clear up - have google widely but no joy so far!
Many thanks
Tim