1139738Simp/*-
267204Sobrien * Copyright (c) 2000 Benno Rice
367204Sobrien * All rights reserved.
467204Sobrien *
567204Sobrien * Redistribution and use in source and binary forms, with or without
667204Sobrien * modification, are permitted provided that the following conditions
767204Sobrien * are met:
867204Sobrien * 1. Redistributions of source code must retain the above copyright
967204Sobrien *    notice, this list of conditions and the following disclaimer.
1067204Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1167204Sobrien *    notice, this list of conditions and the following disclaimer in the
1267204Sobrien *    documentation and/or other materials provided with the distribution.
1367204Sobrien *
1467204Sobrien * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND
1567204Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1667204Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1767204Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1867204Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1967204Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2067204Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2167204Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2267204Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2367204Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2467204Sobrien * SUCH DAMAGE.
2567204Sobrien */
2667204Sobrien
27124140Sobrien#include <sys/cdefs.h>
28124140Sobrien__FBSDID("$FreeBSD$");
29124140Sobrien
3067204Sobrien#include <stand.h>
3167204Sobrien#include "openfirm.h"
3267204Sobrien
3367204Sobrientime_t
3467204Sobrientime(time_t *tloc)
3567204Sobrien{
3667204Sobrien	int secs;
3767204Sobrien
3867204Sobrien	secs = OF_milliseconds() / 1000;
3967204Sobrien	if (tloc)
4067204Sobrien		*tloc = secs;
4167204Sobrien	return secs;
4267204Sobrien}
4368548Sbenno
4468548Sbennoint
4568548Sbennogetsecs()
4668548Sbenno{
4768548Sbenno	time_t	n = 0;
4868548Sbenno	time(&n);
4968548Sbenno	return n;
5068548Sbenno}
5168548Sbenno
5268548Sbennovoid
5368548Sbennodelay(int usecs)
5468548Sbenno{
5568548Sbenno	int	msecs, start;
5668548Sbenno
5768548Sbenno	msecs = usecs / 1000;
5868548Sbenno	start = OF_milliseconds();
5968548Sbenno
6068548Sbenno	while (OF_milliseconds() - start < msecs);
6168548Sbenno}
62