Yes, I've been meaning to respond here. I've looked into finer-grained
resolutions and they would indeed fit well into the Dates module framework
(part of why things were designed the way they were). It wouldn't be too
hard to whip up a nano-second TimeType, probably take me a few days.
Unfortunately, I won't have a few spare days on me until the holidays and
then it might be hit or miss plus juggling other coding priorities. Happy
to advise any willing soul if someone wants to take a gander. I've imagined
something like the following to get started:

immutable Nanosecond <: Period
    value::Int64
end

immutable NanoTime <: TimeType
    dt::DateTime
    nano::Nanosecond
end

# define NanoTime (or whatever you want to call it) constructors. This
might be a little tricky, but you could reuse the DateTime constructor code
to make it easier:
https://github.com/JuliaLang/julia/blob/master/base/dates/types.jl

# define the same Period interface methods for Nanosecond like in
https://github.com/JuliaLang/julia/blob/master/base/dates/periods.jl

# define TimeType interface methods: see
https://github.com/JuliaLang/julia/blob/master/base/dates/accessors.jl,
https://github.com/JuliaLang/julia/blob/master/base/dates/arithmetic.jl,
https://github.com/JuliaLang/julia/blob/master/base/dates/conversions.jl,
and https://github.com/JuliaLang/julia/blob/master/base/dates/query.jl

On Sat, Nov 8, 2014 at 4:19 PM, Stefan Karpinski <[email protected]>
wrote:

> Jacob Quinn is the person who can address this best, but my understanding
> is that while the standard time types don't have that kind of precision,
> the generic time framework makes it easy to add new time types with
> whatever precision you require. Not sure whether you consider that a
> workaround, but that's the deal.
>
> On Sat, Nov 8, 2014 at 8:05 PM, Kevin Squire <[email protected]>
> wrote:
>
>> Hi Dmitrii,
>>
>> As I understand, Julia does not have native type for microsecond and
>>> nanosecond timestamps.
>>>
>>> 1) Why is that?
>>>
>>
>> Most likely because no one who uses Julia has needed it enough to
>> implement it.  Would you be willing to try?
>>
>>
>>> 2) Are there any plans to include/extend current types dealing with time
>>> in near future?
>>>
>>
>> Expanding on my answer to 1:
>>
>> Julia is young, and while core developers do communicate with each other
>> and share their ideas about goals for the next release or two, AFAIK, the
>> main places you'll find those ideas are in issues the julialang github
>> repository.  Additional non-core functionality is added in packages by
>> individuals or groups who need it.  At this point, that's about as formal
>> as it gets.
>>
>> So a better way to phrase this question would be to ask if anyone is
>> doing anything which needs this functionality, and have they implemented
>> anything.  For example, there are individuals who have developed packages
>> that interact with external data acquisition boards (
>> https://github.com/JaneliaSciComp/NIDAQ.jl), who might have need for
>> and/or have developed such functionality (I don't know).
>>
>> One additional note: Julia is flexible enough that adding "native" types
>> is possible, even in packages (see, e.g., the DataArrays package).
>> Depending on the type, it may (or may not) be tedious to do so, but it's
>> definitely possible, and the resulting type can be just as performant as
>> any other native type.
>>
>> Cheers!
>>    Kevin
>>
>
>

Reply via email to