On Sat, Jan 10, 2009 at 5:52 AM, Manlio Perillo <manlio_perillo@libero.it> wrote:
Galchin, Vasili ha scritto:

Manlio,

so compiling to native machine code works ok but if using ghci byte-code interpreter doesn't ..... can you supply your program please?


Right.
Can't you reproduce the problem?

The program is very simple (I was just testing your package, since I suggested the use of clock_gettime to Mauricio in a previous post):

import System.Posix.Realtime.RTTime
import System.Posix.Realtime.RTDataTypes


main = do
 time <- clockGetTime Clock_Monotonic;
 print $ tvSec time
 print $ tvNsec time


runghc rttime.hs


I suspect that this is a problem with shared library loading in ghci, since the C code you use for your package, is also used by the base package (for the Posix subsystem).

By the way: I don't see reasons to add all that code, since it is not used.
                   ^^^ which code?

However, when I tried to remove all the unused code, executing the program gave me a stack exception (maybe I have removed too many things...).



One personal note: I don't like `tvSec` and `tvNsec`, I think `seconds` and `nanoSeconds` is a better choice.
          ^^^ ok .. I agree and will change. I asked others for criticisms(constructive) when I put to hackage but didn't get any. This is good ...
 

Also, it would useful a function to compute elapsed time (maybe a general class in base package, and a specialized instance declaration in posix-realtime for the timespec?)


Vasili


> [...]



Manlio