diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index de6ba2e..e6f6570 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -896,9 +896,10 @@ cgenSizeSuffix dim = tell ["_sizes[", dim, "]"] cgenTypeSymbol :: String -> A.Type -> CGen () cgenTypeSymbol s t = do f <- fget getScalarType - case f t of - Just ct -> tell ["occam_", s, "_", ct] - Nothing -> call genMissingC $ formatCode "genTypeSymbol %" t + case (t, f t) of + (A.Time, _) -> tell ["occam_", s, "_time"] + (_, Just ct) -> tell ["occam_", s, "_", ct] + (_, Nothing) -> call genMissingC $ formatCode "genTypeSymbol %" t cgenIntrinsicFunction :: Meta -> String -> [A.Expression] -> CGen () cgenIntrinsicFunction m s es diff --git a/support/tock_support_cppcsp.h b/support/tock_support_cppcsp.h index 86df8b5..a1ebd34 100644 --- a/support/tock_support_cppcsp.h +++ b/support/tock_support_cppcsp.h @@ -296,6 +296,18 @@ public: }; +// Time addition and subtraction: + +inline csp::Time occam_plus_time (const csp::Time& a, const csp::Time& b, const char *) +{ + return a + b; +} + +inline csp::Time occam_minus_time (const csp::Time& a, const csp::Time& b, const char *) +{ + return a - b; +} + // Time intrinsics for Rain: inline double occam_toSeconds(const csp::Time& val, const char*)