Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006285OCamlOCaml standard librarypublic2014-01-02 01:572014-01-02 15:16
Reportergfxmonk 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Platformx86_64OSLinuxOS Version
Product Version4.01.0 
Target VersionFixed in Version 
Summary0006285: Unix st_mtime has only second-level resolution
Descriptionstat.c (in the `unix` module) uses the old second-level precision data attributes of linux `stat` results:

https://github.com/ocaml/ocaml/blob/trunk/otherlibs/unix/stat.c#L46 [^]

It should use the newer, subsecond-precision attributes where available. Jane Street Core does this:

https://github.com/janestreet/core/blob/master/lib/unix_stubs.c#L426 [^]
Steps To ReproduceThe following script always prints a whole number for `mtime`, despite other programs on the same machine/OS accessing sub-second resolution for `mtime` (e.g python):


#!/usr/bin/env ocamlscript
Ocaml.packs := ["unix"]
--
open Unix
open Printf

let () =
    let this_file = Array.get Sys.argv 0 in
    let stats = Unix.stat this_file in
    printf "mtime: %f" stats.st_mtime
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2014-01-02 01:57 gfxmonk New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker