Coder Social home page Coder Social logo

dates.jl's Introduction

Dates

Note the functionality of this package has been merged into the Base Standard Library. This package exists to allow 0.3 compatibility for dependent packages.

Build Status Coverage Status

A Date and DateTime implementation for Julia

Open the test/runtest.jl file for more examples of code to run and functionality.

Installation/Usage

Installation through the Julia package manager:

julia> Pkg.add("Dates") # Adds the Dates package to your required packages list; installs package
julia> using Dates # Loads Dates code into current julia session

Documentation can be found as a chapter in the Julia manual as well as the API reference.

dates.jl's People

Contributors

jiahao avatar quinnj avatar yonghee-kim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dates.jl's Issues

Easier division of interval?

I may well be missing something but it seems that currently you can't do this:

using Dates
t1 = DateTime(2017,7,1)
t2 = DateTime(2017,7,1,6)
tm = t1 + (t2 - t1)/7  # 1/7 of the way from t1 to t2

I need to do this a lot to interpolate times. As far as I can tell, the following is the only robust way to do it:

tm = t1 + Millisecond(round((t2 - t1) / Millisecond(1))/ 7))

I know the integer division (÷) works, but it doesn't do rounding.

Intervals behave like an integer, but for the actual integer, the following method is standard:

t1 = 0
t2 = 6
tm = t1 + round(Int, (t2 - t1)/7)

This works because Int/Int results in Float64.

This discussion suggests that we perhaps need a special division function:

divround(i::Millisecond, x::Real, roundingmode = RoundNearest) =
   Millisecond( round(i / Millisecond(1) / x, roundingmode) )
tm = t1 + divround(t2 - t1, 7)

In this way, the user can remain ignorant of the fact that Millisecond is the best unit to divide an interval (so that if/when DateTime starts to include microseconds, the user doesn't have to change her code).

Or perhaps we want to create a FloatingpointMillisecond type which would be to Millisecond what Float64 is to Int?

Check year/day/hour/minute/second/millisecond inputs for Date/DateTime

We currently throw an ArgumentError if a month is out of range (1:12) in the Date and DateTime constructors, but nothing else for other Periods (we "roll forward" instead...).
I don't really like the inconsistency of only erroring for months, but I also hate the performance hit doing all the input checking would generate. I'm open to opinions, but until something clear comes up or it really irks someone, I'll leave it as is.

Merge into Base

It's been long-discussed to merge this refactored code into Base, but my make-fu is quite poor and I'm not entirely sure how we want to go about it.
@StefanKarpinski, last we talked, it sounded like you had a good idea how to do the merge. I'm not sure if we would do a submodule a la libuv, with the code still residing in this repo (or JuliaLang/Dates.jl), or if we just want to haul all the code over. There's also the question of where it should live. Is base/dates/ good enough? Do we want to carve out a process for future non-core stdlib packages with something else?

[PkgEval] Dates may have a testing issue on Julia 0.3 (2014-08-14)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-08-13 the testing status was Tests pass.
  • On 2014-08-14 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("Dates")' log
INFO: Cloning cache of Dates from git://github.com/quinnj/Dates.jl.git
INFO: Installing Dates v0.0.2
INFO: Package database updated

>>> 'using Dates' log

>>> test log

signal (15): Terminated
sigprocmask at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: -1457719807)
unknown function (ip: -1465297744)
unknown function (ip: -1458073381)
unknown function (ip: -1458084218)
unknown function (ip: -1458086937)
abstract_eval_constant at ./inference.jl:1006
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_eval_global at ./inference.jl:1027
abstract_eval_symbol at ./inference.jl:1066
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_eval at ./inference.jl:919
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_eval_arg at ./inference.jl:866
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_eval_call at ./inference.jl:878
abstract_eval at ./inference.jl:935
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
... truncated ...
do_test at test.jl:37
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: -1457737384)
unknown function (ip: -1457741111)
unknown function (ip: -1457674674)
unknown function (ip: -1457672000)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: -1457737384)
unknown function (ip: -1457741111)
unknown function (ip: -1457674674)
unknown function (ip: -1457672000)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:285
_start at ./client.jl:354
_start_3B_1699 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4200466)
julia_trampoline at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4199453)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 4199507)
unknown function (ip: 0)

>>> end of log

convert `DateTime` to a number of milliseconds

I've been fiddling with this for awhile now and the best way I've found is:

julia> t = now()
2014-08-21T16:23:59

julia> Dates.toms(t.instant.periods)
63544321439000

I've tried to get dates in a couple different ways and this still seems to work, but it still makes me uncomfortable.

What would you think about a toms function that took in a DateTime?

wrong REQUIRE?

I'm confused: if this package is only for use in Julia 0.3, why does the REQUIRE file specify Julia 0.4?

Allow fractions of a second?

Is it possible to do this:

DateTime(2013,7,1,12,30,59.1)

i.e. to provide seconds as a float?

I think you can only do this at the moment:

DateTime(2013,7,1,12,30,59,1)

to give

2013-07-01T12:30:59.001

(I'm still using v0.3...)

ISO 8601 Zulu dates not parsed

Reproduced this in Juliabox which is running 0.3.11, example:

julia> DateTime("2015-06-11T05:00:00.000Z")                                                                                                
ERROR: ArgumentError("Non-digit character encountered")
 in slotparse at /opt/julia_packages/.julia/v0.3/Dates/src/dates/io.jl:99
 in getslot at /opt/julia_packages/.julia/v0.3/Dates/src/dates/io.jl:108
 in parse at /opt/julia_packages/.julia/v0.3/Dates/src/dates/io.jl:120
 in DateTime at /opt/julia_packages/.julia/v0.3/Dates/src/dates/io.jl:162

julia> DateTime("2015-06-11T05:00:00.000")                                                                                                 
2015-06-11T05:00:00

[PkgEval] Dates may have a testing issue on Julia 0.3 (2014-08-20)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-08-18 the testing status was Tests pass.
  • On 2014-08-20 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("Dates")' log
INFO: Cloning cache of Dates from git://github.com/quinnj/Dates.jl.git
INFO: Installing Dates v0.0.2
INFO: Package database updated

>>> 'using Dates' log

>>> test log

signal (15): Terminated
sigprocmask at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: -703916543)
unknown function (ip: -711494480)
unknown function (ip: -704270090)
unknown function (ip: -704280954)
unknown function (ip: -704283673)
anonymous at ./inference.jl:186
map at ./tuple.jl:47
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
anonymous at ./inference.jl:191
jl_f_apply at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
builtin_tfunction at ./inference.jl:541
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_call at ./inference.jl:860
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_eval_call at ./inference.jl:903
abstract_eval at ./inference.jl:935
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
... truncated ...
do_test at test.jl:37
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: -703934120)
unknown function (ip: -703937847)
unknown function (ip: -703871410)
unknown function (ip: -703868736)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: -703934120)
unknown function (ip: -703937847)
unknown function (ip: -703871410)
unknown function (ip: -703868736)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:285
_start at ./client.jl:354
_start_3B_1699 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4200466)
julia_trampoline at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4199453)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 4199507)
unknown function (ip: 0)

>>> end of log

Info about upcoming removal of packages in the General registry

As described in https://discourse.julialang.org/t/ann-plans-for-removing-packages-that-do-not-yet-support-1-0-from-the-general-registry/ we are planning on removing packages that do not support 1.0 from the General registry. This package has been detected to not support 1.0 and is thus slated to be removed. The removal of packages from the registry will happen approximately a month after this issue is open.

To transition to the new Pkg system using Project.toml, see https://github.com/JuliaRegistries/Registrator.jl#transitioning-from-require-to-projecttoml.
To then tag a new version of the package, see https://github.com/JuliaRegistries/Registrator.jl#via-the-github-app.

If you believe this package has erroneously been detected as not supporting 1.0 or have any other questions, don't hesitate to discuss it here or in the thread linked at the top of this post.

[PkgEval] Dates may have a testing issue on Julia 0.3 (2014-09-13)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-09-12 the testing status was Tests pass.
  • On 2014-09-13 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("Dates")' log
INFO: Installing Dates v0.3.1
INFO: Package database updated

>>> 'using Dates' log
Julia Version 0.3.1-pre+26
Commit 91ba8a9 (2014-08-26 16:55 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

>>> test log

signal (15): Terminated

signal (15): Terminated
syscall at /usr/lib/libc.so.6 (unknown line)
uv__epoll_wait at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
uv__io_poll at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
uv_run at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 1101948853)
jl_get_binding at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
jl_is_const at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_eval_global at ./inference.jl:1026
abstract_eval_symbol at ./inference.jl:1066
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_eval at ./inference.jl:919
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
process_events at ./stream.jl:537
abstract_eval_arg at ./inference.jl:866
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
wait at ./task.jl:273
... truncated ...
do_test at test.jl:37
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 1101742536)
unknown function (ip: 1101738809)
unknown function (ip: 1101805246)
unknown function (ip: 1101807920)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 1101742536)
unknown function (ip: 1101738809)
unknown function (ip: 1101805246)
unknown function (ip: 1101807920)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:285
_start at ./client.jl:354
_start_3B_1717 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4200466)
julia_trampoline at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4199453)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 4199507)
unknown function (ip: 0)

>>> end of log

use start + k*step formulation for more ranges

julia> [Date(2014,1,31):Month(1):Date(2015)]
12-element Array{Date,1}:
 2014-01-31
 2014-02-28
 2014-03-28
 2014-04-28
 2014-05-28
 2014-06-28
 2014-07-28
 2014-08-28
 2014-09-28
 2014-10-28
 2014-11-28
 2014-12-28

I would expect this to give me the last day of each month, which the other technique gives.

Remove Calendar/Timezone type parameters

I've been mulling this over and over and I've gone back and forth many times, mainly stemming from several talks with @StefanKarpinski.
I think I'm finally leaning towards removing Calendar and Timezone from the DateTime parameters, and having them be purely "representation" features. I.e. there is the UTInstant type which wraps a Period type which represents its precision on the UT timeline; then there's the DateTime type which wraps a UTInstant and uses global Calendar/Timezone variables to "show" or represent the wrapped UTInstat to the user or write to IO.

[PkgEval] Dates may have a testing issue on Julia 0.3 (2014-08-09)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.2) and the nightly build of the unstable version (0.3). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-08-08 the testing status was Tests pass.
  • On 2014-08-09 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("Dates")' log
INFO: Cloning cache of Dates from git://github.com/quinnj/Dates.jl.git
INFO: Installing Dates v0.0.2
INFO: Package database updated

>>> 'using Dates' log

>>> test log

signal (15): Terminated

signal (15): Terminated
pthread_cond_wait at /usr/lib/libpthread.so.0 (unknown line)
pthread_cond_wait at /usr/lib/libpthread.so.0 (unknown line)
unknown function (ip: -1184167533)
unknown function (ip: -1184167533)
unknown function (ip: -1115164380)
unknown function (ip: -1115164380)
clone at /usr/lib/libc.so.6 (unknown line)
clone at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0)
unknown function (ip: 0)
typeinf_3B_484 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_call_gf at ./inference.jl:726
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_call at ./inference.jl:845
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
... truncated ...
include at ./boot.jl:245
typeinf at ./inference.jl:1472
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at loading.jl:128
typeinf_3B_484 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:285
typeinf_ext at ./inference.jl:1216
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
_start at ./client.jl:354
unknown function (ip: -1107861139)
_start_3B_1710 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so (unknown line)
unknown function (ip: -1107857039)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
anonymous at test.jl:62
do_test at test.jl:37
unknown function (ip: 4200466)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
julia_trampoline at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: -1107570344)
unknown function (ip: 4199453)
unknown function (ip: -1107574071)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: -1107507649)
unknown function (ip: 4199507)
unknown function (ip: -1107504976)
unknown function (ip: 0)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)

>>> end of log

Implicit local timezone assumed in Epoch

So I am currently in British Summer Time, which is GMT-1 ie, one hour ahead of GMT. At the time I did this, the local time was 52 minutes past 4 in the afternoon.

It seems like the datetime2unix and unix2datetime functions in julia consider the epoch to be 1-1-1970 00:00:00 localtime while both OSX and Java consider the epoch to be 1-1-1970 00:00:00 GMT. This causes issues when converting between the two. What would you think is the best way of handling this?

I realise dates doesn't do full timezones at this time, I still think this assumption of local time in epoch is a bit suspect.

shell> date
Fri 10 Jul 2015 16:52:42 BST

julia> jd=(@jimport(java.util.Date)(())); jld=Dates.now(); t=int(time());

julia> jcall(jd, "toString",JString, ())
"Fri Jul 10 16:52:47 BST 2015"

julia> jld
2015-07-10T16:52:47

julia> div(jcall(jd, "getTime", jlong, ()), 1000)
1436543567

julia> int(Dates.datetime2unix(jld))
1436547167

julia> t
1436543567

julia> int(Dates.datetime2unix(jld)) - div(jcall(jd, "getTime", jlong, ()), 1000)
3600

julia> Dates.unix2datetime(jcall(jd, "getTime", jlong, ())/1000)
2015-07-10T15:52:47.17

julia> Dates.unix2datetime(t)
2015-07-10T15:52:47

[PkgEval] Dates may have a testing issue on Julia 0.3 (2014-08-17)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-08-16 the testing status was Tests pass.
  • On 2014-08-17 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("Dates")' log
INFO: Cloning cache of Dates from git://github.com/quinnj/Dates.jl.git
INFO: Installing Dates v0.0.2
INFO: Package database updated

>>> 'using Dates' log

>>> test log

signal (15): Terminated
sigprocmask at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 244712961)
unknown function (ip: 237135024)
isType at ./inference.jl:0
isType_3B_461 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
anonymous at ./inference.jl:175
map at ./tuple.jl:48
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
anonymous at ./inference.jl:191
jl_f_apply at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
builtin_tfunction at ./inference.jl:541
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_call at ./inference.jl:860
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
abstract_eval_call at ./inference.jl:903
abstract_eval at ./inference.jl:935
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
... truncated ...
do_test at test.jl:37
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 244695384)
unknown function (ip: 244691657)
unknown function (ip: 244758094)
unknown function (ip: 244760768)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 244695384)
unknown function (ip: 244691657)
unknown function (ip: 244758094)
unknown function (ip: 244760768)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:285
_start at ./client.jl:354
_start_3B_1699 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4200466)
julia_trampoline at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4199453)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 4199507)
unknown function (ip: 0)

>>> end of log

How to parse strings with ignorable start characters?

I have some strings to parse which look like "[14:51:00.118]" which are hours, minutes and seconds. I'm having trouble figuring out what to pass to DateFormat to parse this string:

julia> Dates.parse("[14:51:00.118]", DateFormat("[HH:MM:SS.sss]"))
ERROR: BoundsError()
 in parse at /Users/jiahao/.julia/v0.3/Dates/src/io.jl:108

julia> Dates.parse("14:51:00.118", DateFormat("HH:MM:SS.sss"))
4-element Array{Period,1}:
 14 hours        
 51 minutes      
 0 seconds       
 118 milliseconds

julia> Dates.parse("[14:51:00.118]", DateFormat("[HH:MM:SS.sss?"))
ERROR: BoundsError()
 in parse at /Users/jiahao/.julia/v0.3/Dates/src/io.jl:108

julia> Dates.parse("[14:51:00.118]", DateFormat("?HH:MM:SS.sss?"))
ERROR: BoundsError()
 in parse at /Users/jiahao/.julia/v0.3/Dates/src/io.jl:108

julia> Dates.parse("x14:51:00.118", DateFormat("?HH:MM:SS.sss"))
ERROR: BoundsError()
 in parse at /Users/jiahao/.julia/v0.3/Dates/src/io.jl:108

julia> Dates.parse("14:51:00.118]", DateFormat("HH:MM:SS.sss?"))
4-element Array{Period,1}:
 14 hours      
 51 minutes    
 0 seconds     
 0 milliseconds

Explain the results of ceiling Dates?

julia> using Dates

julia> ceil(DateTime(2013, 2, 13, 0, 31, 24), Dates.Minute(15))
2013-02-13T00:45:00

julia> ceil(DateTime(2013, 2, 13, 0, 31, 24), Dates.Minute(16))
2013-02-13T00:32:00

julia> ceil(DateTime(2013, 2, 13, 0, 31, 24), Dates.Minute(17))
2013-02-13T00:33:00

julia> ceil(DateTime(2013, 2, 11, 0, 31, 24), Dates.Minute(17))
2013-02-11T00:40:00

in R
library(lubridate)
ceiling_date(ymd_hms(“2013-02-13 00:31:24”), “15 mins”)
[1] “2013-02-13 00:45:00 UTC”
ceiling_date(ymd_hms(“2013-02-13 00:31:24”), “16 mins”)
[1] “2013-02-13 00:32:00 UTC”
ceiling_date(ymd_hms(“2013-02-13 00:31:24”), “17 mins”)
[1] “2013-02-13 00:34:00 UTC”
ceiling_date(ymd_hms(“2013-02-11 00:31:24”), “17 mins”)
[1] “2013-02-11 00:34:00 UTC”

explain the results of ceiling Dates ? thanks!

[PkgEval] Dates may have a testing issue on Julia 0.3 (2014-09-28)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-09-26 the testing status was Tests pass.
  • On 2014-09-28 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("Dates")' log
INFO: Installing Dates v0.3.1
INFO: Package database updated
INFO: METADATA is out-of-date a you may not have the latest version of Dates
INFO: Use `Pkg.update()` to get the latest versions of your packages

>>> 'using Dates' log
Julia Version 0.3.1
Commit c03f413* (2014-09-21 21:30 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

>>> test log

signal (11): Segmentation fault
unknown function (ip: 549153830)
unknown function (ip: 549153395)
jl_gc_collect at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
allocobj at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
jl_alloc_tuple_uninit at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 548722512)
unknown function (ip: 548724173)
unknown function (ip: 548727845)
unknown function (ip: 548728950)
jl_subtype at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 548775301)
unknown function (ip: 548776494)
unknown function (ip: 548780532)
unknown function (ip: 548782577)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
anonymous at test.jl:62
do_test at test.jl:37
test_all_combos at /home/idunning/pkgtest/.julia/v0.3/Dates/test/ranges.jl:45
jlcall_test_all_combos;21502 at  (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 549069064)
unknown function (ip: 549065337)
unknown function (ip: 549131838)
unknown function (ip: 549134512)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 549069064)
unknown function (ip: 549065337)
unknown function (ip: 549131838)
unknown function (ip: 549134512)
jl_load at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include at ./boot.jl:245
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
include_from_node1 at loading.jl:128
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
process_options at ./client.jl:285
_start at ./client.jl:354
_start_3B_1712 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so (unknown line)
jl_apply_generic at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4200466)
julia_trampoline at /home/idunning/julia03/usr/bin/../lib/libjulia.so (unknown line)
unknown function (ip: 4199453)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 4199507)
unknown function (ip: 0)

INFO: Testing Dates
================================[ ERROR: Dates ]================================

failed process: Process(`/home/idunning/julia03/usr/bin/julia /home/idunning/pkgtest/.julia/v0.3/Dates/test/runtests.jl`, ProcessSignaled(11)) [0]

================================================================================
INFO: No packages to install, update or remove
ERROR: Dates had test errors
 in error at error.jl:21
 in test at pkg/entry.jl:715
 in anonymous at pkg/dir.jl:28
 in cd at ./file.jl:20
 in cd at pkg/dir.jl:28
 in test at pkg.jl:67
 in process_options at ./client.jl:213
 in _start at ./client.jl:354
 in _start_3B_1712 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so

>>> end of log

convert to epoc time

Hey, sorry to bug you again.

I started getting millisecond times like so:

julia> int(Dates.now())
63544407604000

But they don't seem to be in epoc time (milliseconds since epoc? not sure how to say that exactly). I'm wondering what format they're in (do they count up from a different start date? or are they meant to be interpreted differently?) and whether there's an easy way to convert them (I need to use them with ICU.jl, which seems to expect milliseconds in epoc time)

Silent failure on conversion from string to DateTime

Should issues go here or directly to JuliaLang/julia now that this is in base? In any case, if you don't specify a format and your format doesn't match the default format, it's possible to get an incorrect result instead of an error.

julia> DateTime("2014")
ERROR: ArgumentError("Delimiter mismatch. Couldn't find first delimiter, \"-\", in date string")
 in parse at dates/io.jl:116
 in DateTime at dates/io.jl:162

julia> DateTime("2014-09")
2014-09-01T00:00:00

julia> DateTime("2014-09-06")
2014-09-06T00:00:00

julia> DateTime("2014-09-06 02:45:38")
2014-09-01T00:00:00

Of course this works fine if the correct format string is specified.

julia> DateTime("2014-09-06 02:45:38","y-m-d H:M:S")
2014-09-06T02:45:38

Compatibility with Datetime

So I'm asking this without doing any investigating, but I thought you'd have know the answer offhand.

How close is this API from Datetime.jl? Is there going to be a migration effort needed?

Define div or / for Period division?

Up till now, I've only defined div(::Period,::Period) and left /(::Period,::Period) as a no method error. Mainly to match Base's promotional behavior of / and truncation behavior of div because with the discrete behavior of Dates, we only truncate on division (i.e. Periods are like Integers).
I'm wondering if it makes sense to go ahead and define /. Would people be confused if they tried to do Year(1)/Year(2) and got Year(1) as the result?

cc: @StefanKarpinski, @aviks

Date array type wrong?

julia> dates = df[:Date]
1018-element DataArray{UTF8String,1}:
"2010/1/4"
"2010/1/5"
"2010/1/6"

julia> Date(dates, DateFormat("yyyy/mm/dd"))
1018-element Array{Any,1}:
2010-01-04
2010-01-05
2010-01-06

extracting microseconds

Hi,

I have set of data which is linked to timestamps in the form of a string, eg "5/17/2018 13:35:44.746977".

I have tried using this code to convert the string to a DateTime object
ds = "5/17/2018 13:35:44.746977"
DateTime(ds, Dates.DateFormat("m/d/y H:M:S.s]"))
Which works fine if the data does not contain the microseconds part, however I can't figure out how to extract the full time including the microseconds. Is there a way to do that?

For example, dropping everything from the string except for the seconds count, or similar?

Kind regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.