picoev,net.http: use Time.http_header_string method, to improve performance (#22619)

This commit is contained in:
Hitalo Souza 2024-10-22 09:39:48 -04:00 committed by GitHub
parent b2ac2ed627
commit 4e13ddf847
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 6 deletions

View file

@ -128,8 +128,7 @@ pub fn (c &Cookie) str() string {
}
}
if c.expires.year > 1600 {
e := c.expires
time_str := '${e.weekday_str()}, ${e.day.str()} ${e.smonth()} ${e.year} ${e.hhmmss()} GMT'
time_str := c.expires.http_header_string()
b.write_string('; expires=')
b.write_string(time_str)
}

View file

@ -410,10 +410,7 @@ fn update_date_string(mut pv Picoev) {
for {
// get GMT (UTC) time for the HTTP Date header
gmt := time.utc()
mut date_string := gmt.strftime('---, %d --- %Y %H:%M:%S GMT')
date_string = date_string.replace_once('---', gmt.weekday_str())
date_string = date_string.replace_once('---', gmt.smonth())
pv.date = date_string
pv.date = gmt.http_header_string()
time.sleep(time.second)
}
}