PaulStoffregen / Time

Time library for Arduino
http://playground.arduino.cc/code/time
1.25k stars 666 forks source link

Issue with setting time on arduino every #168

Open Exeu opened 2 years ago

Exeu commented 2 years ago

Description

using setTime causes wiered results on printing time on an arduino nano every.

Output is: System current: 12:12:10 134 13 2021

Day would be 134 and month is 13. Expected: Day 11 and month 6

Steps To Reproduce Problem

simply set the time using setTime and compare the time set with the time you get from the time functions.

Hardware & Software

Visual Studio Code (newest version) with platform io Arduino Nano Every

Arduino Sketch

#include <Wire.h> // must be included here so that Arduino library object file references work
#include <RtcDS3231.h>
#include <RotaryEncoder.h>
#include "Arduino.h"
#include "FastLED.h"
#include <TimeLib.h>

void setup() {
    setTime(12, 12, 10, 11, 6, 2021);

  Serial.print("System current: ");
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

void loop() {
}

Errors or Incorrect Output

Output is: System current: 12:12:10 134 13 2021

Makuna commented 1 year ago

https://github.com/Makuna/Rtc/discussions/150