Cookies: avoid timezone confusion
Cookies date are always in GMT time. Using mktime wrongly converts them as local time instead. This would lead to cookies expiring too early or too late.
This commit is contained in:
parent
8540ec2446
commit
32da3d9dae
@ -107,7 +107,11 @@ BHttpTime::Parse()
|
||||
// TODO: The above was used initially. See http://en.wikipedia.org/wiki/Time.h
|
||||
// stippi: I don't know how Christophe had this code compiling initially,
|
||||
// since Haiku does not appear to implement timegm().
|
||||
return mktime(&expireTime);
|
||||
// Using mktime() doesn't cut it, as cookies set with a date shortly in the
|
||||
// future (eg. 1 hour) would expire immediately.
|
||||
time_t t = mktime(&expireTime);
|
||||
t -= mktime(gmtime(&t)) - (int)mktime(localtime(&t));
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user