|
本帖最后由 jianfengbeyond 于 2020-6-29 15:56 编辑
点灯科技 网络时间 Blinker.setTimezone(8.0),时区设置不生效,实际测试时间是0时区的,和中国时间东八区相差8小时。求解
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "********";
char ssid[] = "********";
char pswd[] = "********";
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print("millis", BlinkerTime);
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
BLINKER_LOG("Now second: ", Blinker.second());
BLINKER_LOG("Now minute: ", Blinker.minute());
BLINKER_LOG("Now hour: ", Blinker.hour());
BLINKER_LOG("Now wday: ", Blinker.wday());
BLINKER_LOG("Now month: ", Blinker.month());
BLINKER_LOG("Now mday: ", Blinker.mday());
BLINKER_LOG("Now year: ", Blinker.year());
BLINKER_LOG("Now yday: ", Blinker.yday());
BLINKER_LOG("Now ntp time: ", Blinker.time());
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
Blinker.setTimezone(8.0);
}
void loop()
{
Blinker.run();
}
补充说明:用的是blinker库的示例,库是6月29日点灯科技官网开发文档里下载最新的,8266_package_2.7.1 NodeMCU 1.0开发板。
BUG:时区设置不生效,实际测试时间是0时区的,和中国时间东八区相差8小时,求解。 |
|