mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
picoev,net.http: use Time.http_header_string method, to improve performance (#22619)
This commit is contained in:
parent
b2ac2ed627
commit
4e13ddf847
2 changed files with 2 additions and 6 deletions
|
@ -128,8 +128,7 @@ pub fn (c &Cookie) str() string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if c.expires.year > 1600 {
|
if c.expires.year > 1600 {
|
||||||
e := c.expires
|
time_str := c.expires.http_header_string()
|
||||||
time_str := '${e.weekday_str()}, ${e.day.str()} ${e.smonth()} ${e.year} ${e.hhmmss()} GMT'
|
|
||||||
b.write_string('; expires=')
|
b.write_string('; expires=')
|
||||||
b.write_string(time_str)
|
b.write_string(time_str)
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,10 +410,7 @@ fn update_date_string(mut pv Picoev) {
|
||||||
for {
|
for {
|
||||||
// get GMT (UTC) time for the HTTP Date header
|
// get GMT (UTC) time for the HTTP Date header
|
||||||
gmt := time.utc()
|
gmt := time.utc()
|
||||||
mut date_string := gmt.strftime('---, %d --- %Y %H:%M:%S GMT')
|
pv.date = gmt.http_header_string()
|
||||||
date_string = date_string.replace_once('---', gmt.weekday_str())
|
|
||||||
date_string = date_string.replace_once('---', gmt.smonth())
|
|
||||||
pv.date = date_string
|
|
||||||
time.sleep(time.second)
|
time.sleep(time.second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue