{"action":"created","issue":{"url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/139","repository_url":"https://api.github.com/repos/jmrozanec/cron-utils","labels_url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/139/comments","events_url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/139/events","html_url":"https://github.com/jmrozanec/cron-utils/issues/139","id":193489537,"number":139,"title":"Wrong last execution time if schedule hit is less than one second ago","user":{"login":"danielWQ","id":9846140,"avatar_url":"https://avatars.githubusercontent.com/u/9846140?v=3","gravatar_id":"","url":"https://api.github.com/users/danielWQ","html_url":"https://github.com/danielWQ","followers_url":"https://api.github.com/users/danielWQ/followers","following_url":"https://api.github.com/users/danielWQ/following{/other_user}","gists_url":"https://api.github.com/users/danielWQ/gists{/gist_id}","starred_url":"https://api.github.com/users/danielWQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielWQ/subscriptions","organizations_url":"https://api.github.com/users/danielWQ/orgs","repos_url":"https://api.github.com/users/danielWQ/repos","events_url":"https://api.github.com/users/danielWQ/events{/privacy}","received_events_url":"https://api.github.com/users/danielWQ/received_events","type":"User","site_admin":false},"labels":[{"id":120385664,"url":"https://api.github.com/repos/jmrozanec/cron-utils/labels/bug","name":"bug","color":"fc2929","default":true},{"id":120385667,"url":"https://api.github.com/repos/jmrozanec/cron-utils/labels/contributions%20welcome","name":"contributions welcome","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-05T12:54:41Z","updated_at":"2016-12-05T14:53:17Z","closed_at":null,"body":"If `ExecutionTime` is asked to return the `timeFromLastExecution` (or the `lastExecution`), it returns an unexpected value if the last execution is less than one second ago.\r\n\r\nPlease find an example below, where the first test succeeds and the second one fails.\r\n```\r\npublic class ExecutionTimeTest {\r\n    private final CronParser parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX));\r\n    private final Cron cron = parser.parse(\"0 12 * * *\");\r\n\r\n    @Test\r\n    public void exact_hit_returns_full_interval_duration() {\r\n        final ZonedDateTime time = ZonedDateTime.of(2016, 12, 2, 12, 0, 0, 0, ZoneId.of(\"Europe/Vienna\"));\r\n        final Duration timeFromLastExecution = ExecutionTime.forCron(cron).timeFromLastExecution(time);\r\n        assertThat(timeFromLastExecution, is(equalTo(Duration.ofHours(24))));\r\n    }\r\n\r\n    @Test\r\n    public void fuzzy_hit_returns_very_small_interval_duration() {\r\n        ZonedDateTime time = ZonedDateTime.of(2016, 12, 2, 12, 0, 0, 0, ZoneId.of(\"Europe/Vienna\"));\r\n        time = time.plus(Duration.ofMillis(300));\r\n        final Duration timeFromLastExecution = ExecutionTime.forCron(cron).timeFromLastExecution(time);\r\n        assertThat(timeFromLastExecution, is(lessThan(Duration.ofSeconds(1))));\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/comments/264873856","html_url":"https://github.com/jmrozanec/cron-utils/issues/139#issuecomment-264873856","issue_url":"https://api.github.com/repos/jmrozanec/cron-utils/issues/139","id":264873856,"user":{"login":"danielWQ","id":9846140,"avatar_url":"https://avatars.githubusercontent.com/u/9846140?v=3","gravatar_id":"","url":"https://api.github.com/users/danielWQ","html_url":"https://github.com/danielWQ","followers_url":"https://api.github.com/users/danielWQ/followers","following_url":"https://api.github.com/users/danielWQ/following{/other_user}","gists_url":"https://api.github.com/users/danielWQ/gists{/gist_id}","starred_url":"https://api.github.com/users/danielWQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielWQ/subscriptions","organizations_url":"https://api.github.com/users/danielWQ/orgs","repos_url":"https://api.github.com/users/danielWQ/repos","events_url":"https://api.github.com/users/danielWQ/events{/privacy}","received_events_url":"https://api.github.com/users/danielWQ/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T14:53:17Z","updated_at":"2016-12-05T14:53:17Z","body":"yes, i can create a pull request. can i push to a new branch?"}}
{"actor":{"display_login":"danielWQ"}}