~ubuntu-branches/ubuntu/hoary/cdrtools/hoary

« back to all changes in this revision

Viewing changes to cdrecord/misc.c

  • Committer: Bazaar Package Importer
  • Author(s): Eduard Bloch
  • Date: 2002-04-09 10:03:06 UTC
  • Revision ID: james.westby@ubuntu.com-20020409100306-t4hagiv7gm0fhggv
Tags: upstream-1.10
ImportĀ upstreamĀ versionĀ 1.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)misc.c   1.1 98/08/16 Copyright 1998 J. Schilling */
 
2
#ifndef lint
 
3
static  char sccsid[] =
 
4
        "@(#)misc.c     1.1 98/08/16 Copyright 1998 J. Schilling";
 
5
#endif
 
6
/*
 
7
 *      Misc support functions
 
8
 *
 
9
 *      Copyright (c) 1998 J. Schilling
 
10
 */
 
11
/*
 
12
 * This program is free software; you can redistribute it and/or modify
 
13
 * it under the terms of the GNU General Public License as published by
 
14
 * the Free Software Foundation; either version 2, or (at your option)
 
15
 * any later version.
 
16
 *
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 *
 
22
 * You should have received a copy of the GNU General Public License
 
23
 * along with this program; see the file COPYING.  If not, write to
 
24
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
25
 */
 
26
 
 
27
#include <mconfig.h>
 
28
#include <timedefs.h>
 
29
#include <standard.h>
 
30
 
 
31
EXPORT  void    timevaldiff     __PR((struct timeval *start, struct timeval *stop));
 
32
 
 
33
EXPORT void
 
34
timevaldiff(start, stop)
 
35
        struct timeval  *start;
 
36
        struct timeval  *stop;
 
37
{
 
38
        struct timeval tv;
 
39
 
 
40
        tv.tv_sec = stop->tv_sec - start->tv_sec;
 
41
        tv.tv_usec = stop->tv_usec - start->tv_usec;
 
42
        while (tv.tv_usec > 1000000) {
 
43
                tv.tv_usec -= 1000000;
 
44
                tv.tv_sec += 1;
 
45
        }
 
46
        while (tv.tv_usec < 0) {
 
47
                tv.tv_usec += 1000000;
 
48
                tv.tv_sec -= 1;
 
49
        }
 
50
        *stop = tv;
 
51
}