Skip to content

Commit 2a00781

Browse files
committed
epoffset applies to tsn(), s2t()
1 parent 4fffa26 commit 2a00781

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ const uint8_t SCRIPT_VERS[2] = {5, 3};
9999

100100
#define SPI_FLASH_2SEC_SIZE SPI_FLASH_SEC_SIZE*2
101101

102+
#define UNIX_TS_OFFSET 0
103+
//1740389573
104+
102105
#define SCRIPT_EOL '\n'
103106
#define SCRIPT_FLOAT_PRECISION 2
104107
#define PMEM_SIZE sizeof(Settings->script_pram)
@@ -6086,11 +6089,14 @@ int32_t I2SPlayFile(const char *path, uint32_t decoder_type);
60866089
len = 0;
60876090
goto strexit;
60886091
}
6092+
6093+
60896094
#ifdef USE_FEXTRACT
60906095
if (!strncmp_XP(lp, XPSTR("s2t("), 4)) {
60916096
lp = GetNumericArgument(lp + 4, OPER_EQU, &fvar, 0);
60926097
char str[SCRIPT_MAX_SBSIZE];
6093-
s2tstamp(str, SCRIPT_MAX_SBSIZE, fvar, 0);
6098+
uint32_t secs = (uint32_t)fvar + (uint32_t)glob_script_mem.epoch_offset;
6099+
s2tstamp(str, SCRIPT_MAX_SBSIZE, secs, 0);
60946100
if (sp) strlcpy(sp, str, glob_script_mem.max_ssize);
60956101
len = 0;
60966102
goto strexit;
@@ -6261,7 +6267,7 @@ void tmod_directModeOutput(uint32_t pin);
62616267
if (!strncmp_XP(lp, XPSTR("tsn("), 4)) {
62626268
char str[SCRIPT_MAX_SBSIZE];
62636269
lp = GetStringArgument(lp + 4, OPER_EQU, str, 0);
6264-
fvar = tstamp2l(str);
6270+
fvar = tstamp2l(str) - (uint32_t)glob_script_mem.epoch_offset;
62656271
goto nfuncexit;
62666272
}
62676273
#endif

0 commit comments

Comments
 (0)