time.cc (7870:7cb62588fcdc) | time.cc (8869:fa8dcdd7e26c) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 14 unchanged lines hidden (view full) --- 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Nathan Binkert 29 */ 30 | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 14 unchanged lines hidden (view full) --- 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Nathan Binkert 29 */ 30 |
31#include <cstdlib> 32#include <ctime> |
|
31#include <iostream> 32#include <sstream> 33 34#include "base/time.hh" 35#include "config/use_posix_clock.hh" 36#include "sim/core.hh" 37#include "sim/serialize.hh" 38 --- 100 unchanged lines hidden (view full) --- 139 timespec ts = time; 140 141#if USE_POSIX_CLOCK 142 clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL); 143#else 144 nanosleep(&ts, NULL); 145#endif 146} | 33#include <iostream> 34#include <sstream> 35 36#include "base/time.hh" 37#include "config/use_posix_clock.hh" 38#include "sim/core.hh" 39#include "sim/serialize.hh" 40 --- 100 unchanged lines hidden (view full) --- 141 timespec ts = time; 142 143#if USE_POSIX_CLOCK 144 clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL); 145#else 146 nanosleep(&ts, NULL); 147#endif 148} |
149 150time_t 151mkutctime(struct tm *time) 152{ 153 time_t ret; 154 char *tz; 155 156 tz = getenv("TZ"); 157 setenv("TZ", "", 1); 158 tzset(); 159 ret = mktime(time); 160 if (tz) 161 setenv("TZ", tz, 1); 162 else 163 unsetenv("TZ"); 164 tzset(); 165 return ret; 166} 167 |
|