[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] [RFC] Ptime (was Re: Unix.tm, CLOCK: date handling in MirageOS)



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA384

On 06/26/2015 14:46, Daniel BÃnzli wrote:
> Le vendredi, 26 juin 2015 Ã 13:49, Hannes Mehnert a Ãcrit :
>> Shouldn't the validity invariants hold by construction -- at
>> least I'd prefer that it's not possible to create a date &
>> utc_time which are invalid. That'd require some constructor
>> functions and accessors for date and utc_time, but I'd prefer it
>> over those valid_* functions which users will need to call.
> 
> It's not the goal of this library to provide an abstract type for
> date-time values (this would rather be the goal of a calendar
> library). The goal of the library is to provide a type for POSIX
> timestamps. In fact these valid_* functions should not be called by
> the client, they are only here as a convenience, they are called by
> Ptime.of_{date_utc_time,date} functions which is what you should
> use whenever you just parsed some calendar field and need to map
> them to a POSIX timestamp. For handling date and time in programs I
> prefer to keep values representing timestamps along a well defined
> timeline in your data structures, rather than juggle with date *
> utc_time pairs.


Ok, understood.


>> I also wonder since the finest granularity are seconds
> No. The module says nothing about this. While the utc_time type has
> granularity up to the second, that's not the case for a POSIX
> timestamp parsed from a RFC 3339 timestamp or created through
> Ptime.of_posix_s.
> 
>> Or, what is the meaning of adding .5 to a t?
> Add 0.5 second.

Makes sense.


Hannes

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCQAGBQJVjWfCAAoJELyJZYjffCjuUIAQAJRVxuqnXttpDiYHM02FAnlq
NDH/y+I6DsC0dk8ZvIDYKm1cQKiVFGUEqDxXIyWHRbk2YZPA0Jny6+H35a7CRp9q
DSnaw40SRjhwdGsFxP8DzHrCqz7rteaAMqiIEvmk6iYTbbR8DcjoWj6tREjtEkiK
2+7cpvB2NN11cgs7R0dLKbuHR2jM6QHY/qSjGhkMuo+uCLqvZWyUpLOPPK7lWrfu
0bxXYB1uS4DDe2vKPp367ZgDl4CAv/rl7gEHyzh0ZOCkK5qjp8H1VLTeoZjKVnJy
kD/8GsBptFV7YONpT3RwtibWnKLXYnAbzFbfUdYbDEX4N/erwQxFvh71ZG4VKpOI
innvlNYCJxJbC7VZ8ZF8+Kpfl0icQe+B9vKUH/aoW14kvFDpW72BBFZaQt98pfbW
5M/+vW/DhTHJDpE/+Up8tKO6gxbJIIxqmFQ2HN2IpMI9RyZhCKzrGO0iATOPHfhq
srQPWjKmyHgnXfgEuTBlY7PN2GraAKyvZe8VyJFBZzA83C1jeWCSnIRG6lCWw+I2
xEy36oiVOsZbagwXTfkKyeTby8JPsViqaSyhk4ValBLRAH9/0MsNcV4HbOjdycOd
OI0keGPp9nMDXe19OI/UQO1y825o/IPC9vyQ5TobtiqvJ/Ig94j4ppFLFxV/gZcE
CNGdz/woyyFuwo72wtIb
=5+6y
-----END PGP SIGNATURE-----

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.