we have fixed the date stamp now

This commit is contained in:
2020-10-14 12:25:52 +02:00
parent 6c4eaaa764
commit 99c1579137
3 changed files with 18 additions and 29 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ config({"development", "production"}, {
postgres = {
host = "postgres",
user = "postgres",
-- password = "the_password",
password = "the_password",
database = "postgres"
}
})
+9 -25
View File
@@ -70,35 +70,19 @@ local function Splhandler(self)
return
end
-- we have to split the `hr:min:sec` and `month/day/year` strings from SPL
-- and since SPL uses both "." and "-" for dates .. somehow .. we have to do more dirty tricks ..
local function Split(s, delimiters)
for i, delimiter in ipairs(delimiters) do
local result = {}
if delimiter == "." then
for match in string.gmatch(s, "[^%.]+") do
table.insert(result, match)
end
else
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match)
end
end
if table.getn(result) == 3 then
return result
else
print("something is wrong: ".. s)
end
-- we have to split the `hr:min:sec` and `year-month-day` strings from SPL
local function Split(s, delimiter)
local result = {}
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match)
end
return result
end
local split_airtime = Split(airtime, {":"})
local split_airtime = Split(airtime, ":")
local airtime_hr, airtime_min, airtime_sec = split_airtime[1], split_airtime[2], split_airtime[3]
local split_airdate = Split(airdate, {"/", ".", "-"})
local split_airdate = Split(airdate, "-")
local airdate_year, airdate_month, airdate_day = split_airdate[1], split_airdate[2], split_airdate[3]
local airtime_stamp = os.time{year=airdate_year, month=airdate_month, day=airdate_day, hour=airtime_hr, min=airtime_min, sec=airtime_sec}