[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [MirageOS-devel] Unix.tm, CLOCK: date handling in MirageOS
On 22 Jun 2015, at 16:40, Daniel BÃnzli <daniel.buenzli@xxxxxxxxxxxx> wrote: > a) not to give its result with the weird offsets > b) simply return a recordless (y,m,d) * (hh,mm,ss) value â I guess people do > not care about wday, which only allows you to specify inconsistant dates. > > So Bos.OS.Time could simply have these two functions pure OCaml functions: > > val posix_s_to_date : float -> (int * int * int) * (int * int * int) > val date_to_posix_s : (int * int * int) * (int * int * int) -> float option With a few more individual functions for smaller sets of fields this wouldn't be too bad. type time = int * int * int type date = int * int * int val posix_s_to_time : float -> time val posix_s_to_date : float -> date A lot of the time you just want to get this information out to prettyprint the date, and not manipulate it. A loosely typed interface like the above would be sufficient. > I didn't provide them because I thought this would be provided by the > vapourware calendar library. But if that's only what people need I can > provide them. > > But does this really help mirage ? Isn't there already too much unixy crap in > Bos, namely OS.{Path,File,Dir,Cmd} (which only depend on Sys though) ? The main criticism of Bos from a Mirage perspective is that it mixes together all the Unix-y concerns into one library. Notions from POSIX storage (Path/File/Dir), shell (Cmd) and clock (Time) should all be separate in Mirage, but having one Bos library forces us to define something for each of them. With only Irmin storage, then we may never need anything other than Time for many Mirage applications. > An alternative would be to extract a Bos.OS.Time as an independent module > Ptime for POSIX time that just provides what Bos.OS.Time provides [1] along > with the above functions. And that would solve the above problem indeed, perhaps with a module alias for the existing Bos.OS.Time module. Do you have any thoughts on the jsoo linking hack that you used in jsont? I liked how I could compile JSON pickler combinators efficiently using the native JSON or Jsonm parsers depending on which OS (Unix vs JavaScript) was in use. I imagine something similar is needed to efficiently pick the best platform clock. If only we had a build system that could deal with all these permutations :) -anil _______________________________________________ MirageOS-devel mailing list MirageOS-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |