Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Work around time() brokenness on Solaris.
On Solaris and OpenIndiana, time() goes backwards. It and gettimeofday() occasionally jump back to 1970 and return zero seconds — although the tv_usec field is still sane, bizarrely. CR7121035 in Solaris, https://www.illumos.org/issues/1871 in OpenIndiana. It seems that gethrtime() doesn't suffer the same problem, so let's use that instead of time() for now. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
- Loading branch information
David Woodhouse
authored and
David Woodhouse
committed
Apr 19, 2012
1 parent
418fade
commit a51e233
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* OpenConnect (SSL + DTLS) VPN client | ||
* | ||
* Copyright © 2008-2012 Intel Corporation. | ||
* | ||
* Authors: David Woodhouse <dwmw2@infradead.org> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public License | ||
* version 2.1, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to: | ||
* | ||
* Free Software Foundation, Inc. | ||
* 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301 USA | ||
*/ | ||
|
||
#include "openconnect-internal.h" | ||
|
||
#ifdef __sun__ | ||
#include <sys/time.h> | ||
|
||
time_t openconnect__time(time_t *t) | ||
{ | ||
time_t s = gethrtime() / 1000000000LL; | ||
if (t) | ||
*t = s; | ||
|
||
return s; | ||
} | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters