MCPcopy Create free account
hub / github.com/OpenEPaperLink/OpenEPaperLink / prepareTIME_RAW

Function prepareTIME_RAW

ESP32_AP-Flasher/src/contentmanager.cpp:3136–3156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3134}
3135
3136void prepareTIME_RAW(const uint8_t *dst, time_t now) {
3137 uint8_t *data;
3138 size_t len = 1 + 4 + 4 + 1;
3139 struct tm timeinfo;
3140 localtime_r(&now, &timeinfo);
3141 uint32_t local_time = convert_tm_to_seconds(&timeinfo) + 20;// Adding 20 seconds for the average of upload time
3142 uint32_t unix_time = now + 20;
3143 data = new uint8_t[len + 1];
3144 data[0] = len;// Length all
3145 data[1] = 0x01;// Version of Time and RAW
3146 data[2] = ((uint8_t*)&local_time)[0];
3147 data[3] = ((uint8_t*)&local_time)[1];
3148 data[4] = ((uint8_t*)&local_time)[2];
3149 data[5] = ((uint8_t*)&local_time)[3];
3150 data[6] = ((uint8_t*)&unix_time)[0];
3151 data[7] = ((uint8_t*)&unix_time)[1];
3152 data[8] = ((uint8_t*)&unix_time)[2];
3153 data[9] = ((uint8_t*)&unix_time)[3];
3154 data[10] = 1; // Design, 1 = Full DateTime 2 = Just Time Segment Style
3155 prepareDataAvail(data, len + 1, DATATYPE_TIME_RAW_DATA, dst);
3156}
3157#endif
3158
3159void getTemplate(JsonDocument &json, const uint8_t id, const uint8_t hwtype) {

Callers 1

drawNewFunction · 0.85

Calls 2

convert_tm_to_secondsFunction · 0.85
prepareDataAvailFunction · 0.85

Tested by

no test coverage detected