-//----------------------------------------------------------------------
-// Copyright (C) 2006 - 2007 by the FRESCOR consortium:
+// -----------------------------------------------------------------------
+// Copyright (C) 2006 - 2008 FRESCOR consortium partners:
//
// Universidad de Cantabria, SPAIN
// University of York, UK
// Scuola Superiore Sant'Anna, ITALY
// Kaiserslautern University, GERMANY
-// Univ. Politecnica Valencia, SPAIN
+// Univ. Politécnica Valencia, SPAIN
// Czech Technical University in Prague, CZECH REPUBLIC
// ENEA SWEDEN
// Thales Communication S.A. FRANCE
// Rapita Systems Ltd UK
// Evidence ITALY
//
-// See http://www.frescor.org
+// See http://www.frescor.org for a link to partners' websites
//
-// The FRESCOR project (FP6/2005/IST/5-034026) is funded
+// FRESCOR project (FP6/2005/IST/5-034026) is funded
// in part by the European Union Sixth Framework Programme
// The European Union is not liable of any use that may be
// made of this code.
// Universidad de Cantabria, SPAIN
// University of York, UK
//
-// This file is part of FOSA (Frsh Operating System Abstraction)
+// FSF API web pages: http://marte.unican.es/fsf/docs
+// http://shark.sssup.it/contrib/first/docs/
+//
+// This file is part of FOSA (Frsh Operating System Adaption)
//
-// FOSA is free software; you can redistribute it and/or modify it
-// under terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option) any
-// later version. FOSA is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details. You should have received a
-// copy of the GNU General Public License along with FOSA; see file
-// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
-// Cambridge, MA 02139, USA.
+// FOSA is free software; you can redistribute it and/or modify it
+// under terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option) any
+// later version. FOSA is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details. You should have received a
+// copy of the GNU General Public License along with FOSA; see file
+// COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
+// Cambridge, MA 02139, USA.
//
-// As a special exception, including FOSA header files in a file,
-// instantiating FOSA generics or templates, or linking other files
-// with FOSA objects to produce an executable application, does not
-// by itself cause the resulting executable application to be covered
-// by the GNU General Public License. This exception does not
-// however invalidate any other reasons why the executable file might be
-// covered by the GNU Public License.
+// As a special exception, including FOSA header files in a file,
+// instantiating FOSA generics or templates, or linking other files
+// with FOSA objects to produce an executable application, does not
+// by itself cause the resulting executable application to be covered
+// by the GNU General Public License. This exception does not
+// however invalidate any other reasons why the executable file might be
+// covered by the GNU Public License.
// -----------------------------------------------------------------------
//fosa_time_numeric.h
//==============================================
#define msec_to_fosa_time(msec) (msec) * 1000000
#define fosa_time_to_usec(time) (time) / 1000
#define usec_to_fosa_time(usec) (usec) * 1000
+#define fosa_time_to_nsec(time) (time)
+#define nsec_to_fosa_time(nsec) (nsec)
+
#define timespec_to_fosa_time(time_type, tspec) ((time_type) (tspec).tv_sec) * 1000000000 + (time_type) (tspec).tv_nsec
(tspec).tv_nsec = (time) % 1000000000; \
} while(0)
-
+#define fosa_time_to_double(time) (double) (time) * 1e-9;
+#define fosa_double_to_time(time_type, time) (time_type) (time * 1e9)
#endif
#define msec_to_fosa_time(msec) (msec) * 1000
#define fosa_time_to_usec(time) (time)
#define usec_to_fosa_time(usec) (usec)
+#define fosa_time_to_nsec(time) (time) * 1000
+#define nsec_to_fosa_time(nsec) (nsec) / 1000
#define timespec_to_fosa_time(time_type, tspec) ( (time_type) (tspec).tv_sec) * 1000000 + (time_type) (tspec).tv_nsec/1000
(tspec).tv_nsec = ( (time) % 1000000) * 1000; \
} while(0)
+#define fosa_time_to_double(time) (double) (time) * 1e-6;
+#define fosa_double_to_time(time_type, time) (time_type) (time * 1e6)
#endif
#define msec_to_fosa_time(msec) (msec)
#define fosa_time_to_usec(time) (time) * 1000
#define usec_to_fosa_time(usec) (usec) / 1000
+#define fosa_time_to_nsec(time) (time) * 1000000
+#define nsec_to_fosa_time(nsec) (nsec) / 1000000
#define timespec_to_fosa_time(time_type, tspec) ( (time_type) (tspec).tv_sec) * 1000 + (time_type) (tspec).tv_nsec/1000000
(tspec).tv_nsec = ( (time) % 1000) * 1000000; \
} while(0)
+#define fosa_time_to_double(time) (double) (time) * 1e-3;
+#define fosa_double_to_time(time_type, time) (time_type) (time) * 1e3
+
#endif
return result;
}
+// ---------------------------------------------------------
+
+
+static inline fosa_rel_time_t fosa_rel_time_times_integer(fosa_rel_time_t time, long multiplier)
+{
+ fosa_rel_time_t result;
+
+ result = time * multiplier;
+
+ return result;
+}
+
+
+// ---------------------------------------------------------
+
+static inline fosa_rel_time_t fosa_rel_time_divided_by_integer(fosa_rel_time_t time, long divider)
+{
+ return time / divider;
+}
+
+
+
+
/* Comparison */
/**************/
}
+// -----------------------------------------------------------
+
+static inline bool fosa_rel_time_equal(fosa_rel_time_t relt1, fosa_rel_time_t relt2)
+{
+ bool result;
+
+ result = relt1 == relt2;
+
+ return result;
+}
+
+
+// -----------------------------------------------------------
+
+static inline bool fosa_abs_time_equal(fosa_abs_time_t abst1, fosa_abs_time_t abst2)
+{
+ bool result;
+
+ result = abst1 == abst2;
+
+ return result;
+}
+
+// -----------------------------------------------------------
+
+static inline bool fosa_rel_time_is_null(fosa_rel_time_t relt)
+{
+ bool result;
+
+ result = relt == 0;
+
+ return result;
+}
+
+
+// -----------------------------------------------------------
+
+static inline bool fosa_abs_time_is_null(fosa_abs_time_t abst)
+{
+ bool result;
+
+ result = abst == 0;
+
+ return result;
+}
+
+
+
/* Conversion */
/**************/
static inline fosa_rel_time_t fosa_msec_to_rel_time(long msec)
}
+
+// --------------------------------------------------
+
+static inline fosa_rel_time_t fosa_nsec_to_rel_time(long nsec)
+{
+ fosa_rel_time_t result;
+
+ result = nsec_to_fosa_time((fosa_rel_time_t ) nsec);
+
+ return result;
+}
+
+// --------------------------------------------------
+
+static inline long fosa_rel_time_to_nsec(fosa_rel_time_t relt)
+{
+ long result;
+
+ result = fosa_time_to_nsec(relt);
+
+ return result;
+}
+
+
+// --------------------------------------------------
+
+static inline fosa_abs_time_t fosa_nsec_to_abs_time(long nsec)
+{
+ fosa_abs_time_t result;
+
+ result = nsec_to_fosa_time( (fosa_abs_time_t) nsec);
+
+ return result;
+}
+
+// --------------------------------------------------
+
+static inline long fosa_abs_time_to_nsec(fosa_abs_time_t abst)
+{
+ long result;
+
+ result = fosa_time_to_nsec(abst);
+
+ return result;
+}
+
// --------------------------------------------------
static inline fosa_rel_time_t fosa_timespec_to_rel_time(struct timespec time_tspec)
}
+
+// --------------------------------------------------
+
+static inline double fosa_rel_time_to_double(fosa_rel_time_t relt)
+{
+ double result;
+
+ result = fosa_time_to_double(relt);
+ return result;
+}
+
+
+// --------------------------------------------------
+
+static inline double fosa_double_to_rel_time(double time)
+{
+ fosa_rel_time_t result;
+
+ result = fosa_double_to_time(fosa_rel_time_t, time);
+ return result;
+}
+
+
+
+
#endif /* !FOSA_TIME_H_ */