devork

E pur si muove

Time, floating points and python modules handling time

Saturday, March 28, 2009

Some memory in the back of my mind tells I've once read a rant about storing time that argued you should never store time in floating point variables. My memory seems to think the rant convinced me and it does indeed seem better to store time in integers so that time doesn't go and change little bits due to rounding etc. and indeed the C library seems to stick to that, mostly (difftime() returns a double for example).

When looking at Python the stdlib datetime module seems to do this too. However ofter people scoff at the datetime module and recommend the use of mxDateTime instead, it is a lot better supposedly. But looking at how it stores time it seems to use double values interally.

So I am wondering, if mxDateTime gets away with storing time as floating points is there really a disadvantage to it? Is there a point to avoiding floating point numbers while handling time?

Reading a 64-bit core from a 32-bit proc on solaris?

Saturday, March 28, 2009

I'm trying to read some pointers from a 64-bit address space file (from /proc/pid/as) while running in a 32-bit process - all this on Solaris. To do this I'm using the transitional large file compilation environment, i.e. where you get both open()/pread() and open64()/pread64() since I still want to be able to read a 32-bit core. However when doing the pread64() call on the address space I keep getting EOVERFLOW, no matter what values I put in - even trying to read the first byte of the core. And reading the first byte of a 64-bit core using simply pread(), which as far as I can tell should work, fails too. EOVERFLOW whatever I do.

Is this simply Solaris stopping me from reading a core from a 64-bit proc? But why wouldn't it stop me at the time I do the open64() call in that case? Any clues would be appreciated.

Replacing the screen of your digital camera

Monday, March 23, 2009

The screen of my Canon Digital Ixus 40 compact camera broke on my last trip (sport climbing in Geyikbayiri near Antalya, Turkey - if you climb: it's an amzing place!) which made me rather sad. But with the help of Ebay I found a new screen and have just managed to replace it.

It only took about 1h40 of careful fiddling and figuring out how the camera was stuck together while being nervous of breaking it even more. But the end result was successful!

Subscribe to: Posts (Atom)