source: SVN/cambria/redboot/host/tools/Utils/common/eCosStd.cpp @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 1.6 KB
Line 
1//####COPYRIGHTBEGIN####
2//                                                                         
3// ----------------------------------------------------------------------------
4// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5//
6// This program is part of the eCos host tools.
7//
8// This program is free software; you can redistribute it and/or modify it
9// under the terms of the GNU General Public License as published by the Free
10// Software Foundation; either version 2 of the License, or (at your option)
11// any later version.
12//
13// This program is distributed in the hope that it will be useful, but WITHOUT
14// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
16// more details.
17//
18// You should have received a copy of the GNU General Public License along with
19// this program; if not, write to the Free Software Foundation, Inc.,
20// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21//
22// ----------------------------------------------------------------------------
23//                                                                         
24//####COPYRIGHTEND####
25#include "eCosStd.h"
26
27Time Now()
28{
29#ifdef _WIN32
30  __int64 ft;
31  SYSTEMTIME st;
32  GetSystemTime (&st);
33  SystemTimeToFileTime(&st,(FILETIME *)&ft);
34  return Time(ft)/10000;
35#else // UNIX
36  struct timeb tp;
37  ftime(&tp);
38  // A negative time would be bad news, but we're not in touble until 2038
39  return 1000*Time(tp.time)+tp.millitm;
40#endif
41}
42
43int MIN(int a, int b) { return a<b?a:b; } 
44int MAX(int a, int b) { return a>b?a:b; }
45
46
Note: See TracBrowser for help on using the repository browser.