1 /* @(#)scgtimes.c 1.4 09/07/11 Copyright 1995-2009 J. Schilling */ 2 #include <schily/mconfig.h> 3 #ifndef lint 4 static UConst char sccsid[] = 5 "@(#)scgtimes.c 1.4 09/07/11 Copyright 1995-2009 J. Schilling"; 6 #endif 7 /* 8 * SCSI user level command timing 9 * 10 * Copyright (c) 1995-2009 J. Schilling 11 */ 12 /* 13 * The contents of this file are subject to the terms of the 14 * Common Development and Distribution License, Version 1.0 only 15 * (the "License"). You may not use this file except in compliance 16 * with the License. 17 * 18 * See the file CDDL.Schily.txt in this distribution for details. 19 * A copy of the CDDL is also available via the Internet at 20 * http://www.opensource.org/licenses/cddl1.txt 21 * 22 * The following exceptions apply: 23 * CDDL �3.6 needs to be replaced by: "You may create a Larger Work by 24 * combining Covered Software with other code if all other code is governed by 25 * the terms of a license that is OSI approved (see www.opensource.org) and 26 * you may distribute the Larger Work as a single product. In such a case, 27 * You must make sure the requirements of this License are fulfilled for 28 * the Covered Software." 29 * 30 * When distributing Covered Code, include this CDDL HEADER in each 31 * file and include the License file CDDL.Schily.txt from this distribution. 32 */ 33 34 #include <schily/standard.h> 35 #include <schily/time.h> 36 #include <schily/schily.h> 37 38 #include <scg/scsitransp.h> 39 #include "scgtimes.h" 40 41 EXPORT void __scg_times __PR((SCSI *scgp)); 42 43 /* 44 * We don't like to make this a public interface to prevent bad users 45 * from making our timing incorrect. 46 */ 47 EXPORT void __scg_times(scgp)48__scg_times(scgp) 49 SCSI *scgp; 50 { 51 struct timeval *stp = scgp->cmdstop; 52 53 gettimeofday(stp, (struct timezone *)0); 54 stp->tv_sec -= scgp->cmdstart->tv_sec; 55 stp->tv_usec -= scgp->cmdstart->tv_usec; 56 while (stp->tv_usec < 0) { 57 stp->tv_sec -= 1; 58 stp->tv_usec += 1000000; 59 } 60 } 61