bug #2034: Improve cookie expiration time handling
(cherry picked from commit 281145507e5e46102ab98656ed1c012853787537)