1 /* 2 * Copyright (c) 2002, Intel Corporation. All rights reserved. 3 * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com 4 * This file is licensed under the GPL license. For the full content 5 * of this license, see the COPYING file at the top level of this 6 * source tree. 7 * 8 * Helper functions used to reset the time to close to the current 9 * time at the end of the test. 10 * 11 * Since these helper functions are made specifically to be included 12 * in certain tests, they make use of some libraries already included 13 * by those tests. 14 */ 15 int getBeforeTime(struct timespec *tpget) 16 { 17 if (clock_gettime(CLOCK_REALTIME, tpget) != 0) { 18 perror("clock_gettime() did not return success\n"); 19 perror("clock may not be reset properly\n"); 20 return PTS_UNRESOLVED; 21 } 22 return PTS_PASS; 23 } 24 25 int setBackTime(struct timespec tpset) 26 { 27 if (clock_settime(CLOCK_REALTIME, &tpset) != 0) { 28 perror("clock_settime() did not return success\n"); 29 perror("clock may not be reset properly\n"); 30 return PTS_UNRESOLVED; 31 } 32 return PTS_PASS; 33 } 34 35