Your mode code is correct (sort of). The *nix mode is octal (which is base 8). You printed it in base 10! 0x640 == 416. You need to break out the bits of the mode with, say, bitwise and (&) (depending on your algorithm you might be able to use vec). If you
require 'sys/stat.ph'; you'll get some useful constants to help you decode the mode. Check the *nix manual for stat(2) to find out more about those useful constants...
localtime might be useful, too.
--traveler