{"action":"opened","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/1745","repository_url":"https://api.github.com/repos/esp8266/Arduino","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/1745/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/1745/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/1745/events","html_url":"https://github.com/esp8266/Arduino/issues/1745","id":139731625,"number":1745,"title":"mktime return bad parameter","user":{"login":"pipi61","id":9288482,"avatar_url":"https://avatars.githubusercontent.com/u/9288482?v=3","gravatar_id":"","url":"https://api.github.com/users/pipi61","html_url":"https://github.com/pipi61","followers_url":"https://api.github.com/users/pipi61/followers","following_url":"https://api.github.com/users/pipi61/following{/other_user}","gists_url":"https://api.github.com/users/pipi61/gists{/gist_id}","starred_url":"https://api.github.com/users/pipi61/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pipi61/subscriptions","organizations_url":"https://api.github.com/users/pipi61/orgs","repos_url":"https://api.github.com/users/pipi61/repos","events_url":"https://api.github.com/users/pipi61/events{/privacy}","received_events_url":"https://api.github.com/users/pipi61/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-09T23:20:13Z","updated_at":"2016-03-09T23:20:13Z","closed_at":null,"body":"Please fill the info fields, it helps to get you faster support ;)\r\n\r\nif you have a stack dump decode it:\r\nhttps://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.md\r\n\r\nfor better debug messages:\r\nhttps://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.md\r\n\r\n----------------------------- Remove above -----------------------------\r\n\r\n### Basic Infos\r\n\r\n#### Hardware\r\nHardware:\t\t\t?ESP-03?\r\nCore Version:      \t??\r\n\r\ngit version 2016 marc 01 Arduino167 esp8266-2.1.0  sdk1.5.1_16_01_08\r\n### Description\r\n\r\nProblem description\r\n\r\n### Settings in IDE\r\n\r\nModule:  \t\t\t?Generic ESP8266 Module?\r\nFlash Size: \t\t?512k?\r\nCPU Frequency:\t\t?80Mhz?\r\nFlash Mode:\t\t\t?dio?\r\nFlash Frequency:\t?40Mhz?\r\nUpload Using:\t\t? SERIAL?\r\nReset Method:\t\t?ck?\r\n\r\n\r\n### Sketch\r\n\r\n```cpp\r\n#include <stdio.h>\r\n#include <time.h>\r\nvoid setup(void)\r\n{\r\n\tint year;\r\n  struct tm *idotmpstruct, timetmps32;\r\n  time_t timetmp32;\r\n\r\n  char buff[100];\r\n  //  1332640800 - 2; //1332640800 2012/3/25  hetn:1   2:0:0\r\n  \r\n   Serial.begin(115200);\r\n  timetmp32 = 0;\r\n  idotmpstruct = &timetmps32;\r\n//idotmpstruct=localtime(&timetmp32);\r\n  for (year = 2012; year < 2015; year++)\r\n\t  {\r\n\t\tidotmpstruct->tm_year = year - 1900;\r\n\t\tidotmpstruct->tm_mon = 2;\t/*//02->marcius */\r\n\t\tidotmpstruct->tm_mday = 25;\t/*/lehetsges vasrnap :25..31 */\r\n\t\tidotmpstruct->tm_hour = 2;\r\n\t\tidotmpstruct->tm_min = 0;\r\n\t\tidotmpstruct->tm_sec = 0;\r\n\t\tidotmpstruct->tm_wday = 0;\t/*/dummy */\r\n\t\ttimetmp32 = mktime(idotmpstruct);\t/*/elllit timestamp */\r\n\t\t//printf(\" %lu \", timetmp32);\r\n\t\tSerial.print(timetmp32);\r\n\t\tidotmpstruct = localtime(&timetmp32);\r\n\t\tsprintf(buff, \" %d/%d/%d  %d:%d:%d  hetn:%d \\r\\n\",\t/* Weekday (0--6; Sunday,vas = 0) */\r\n\t\t\t\tidotmpstruct->tm_year + 1900, idotmpstruct->tm_mon + 1, idotmpstruct->tm_mday, idotmpstruct->tm_hour, idotmpstruct->tm_min, idotmpstruct->tm_sec, idotmpstruct->tm_wday);\t/*/,tb.millitm); */\r\n\t\t//printf(\"%s\", buff);\r\n\t\tSerial.print(buff);\r\n\t  }\r\n}\r\nvoid loop ()\r\n{\r\n}\r\n\r\n### Debug Messages\r\n\r\n```\r\nmessages here\r\nESP 8266 mktime return bad parameter, display output:\r\n-582025952 1951/7/23  14:7:28  hetn:1 \r\n-550489952 1952/7/22  14:7:28  hetn:2 \r\n-518953952 1953/7/22  14:7:28  hetn:3 \r\n\r\nhttp://www.tutorialspoint.com/compile_c_online.php\r\nif compile on linux C, the display output ok:\r\n 1332640800 2012/3/25  2:0:0  hetn:0\r\n 1364176800 2013/3/25  2:0:0  hetn:1\r\n 1395712800 2014/3/25  2:0:0  hetn:2\r\n\r\nThank You\r\nIstvan"}}