Skip to content

Commit 674a27f

Browse files
authored
Update README.md (#7)
* Update README.md * Update README.md * Update index.md
1 parent 71a79c7 commit 674a27f

File tree

2 files changed

+2
-58
lines changed

2 files changed

+2
-58
lines changed

README.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,12 @@ cron = Cron("*/5 * * * *")
3636
prev_time = prev(cron, DateTime("2025-01-01T12:03:00")) # 2025-01-01T12:00:00
3737
```
3838

39-
Compute next match offset-style (not chrono-style)
40-
```julia
41-
cron = Cron("*/5 * * * *")
42-
next_offset_time = next_offset(cron, DateTime("2025-01-01T12:03:00")) # 2025-01-01T12:08:00
43-
```
44-
4539
Generate 4 upcoming triggers strictly after a start time
4640
```julia
4741
cron = Cron("*/5 * * * *")
4842
ts = timesteps(cron, DateTime("2025-01-01T12:03:00"), 4) # 12:05, 12:10, 12:15, 12:20
4943
```
5044

51-
Create infinite offset-based iterator from starting point
52-
```julia
53-
cron = Cron("*/5 * * * *")
54-
start = DateTime("2025-01-01T12:07:00")
55-
xs = collect(take(gen_times(cron, start), 4))
56-
# [
57-
# DateTime("2025-01-01T12:12:00"),
58-
# DateTime("2025-01-01T12:17:00"),
59-
# DateTime("2025-01-01T12:22:00"),
60-
# DateTime("2025-01-01T12:27:00"),
61-
# ]
62-
```
63-
6445
Block until the next trigger (uses system clock) ie trigger once
6546
```julia
6647
cron = Cron("*/5 * * * *")
@@ -76,7 +57,7 @@ Trigger every minutes
7657
cron = Cron("*/1 * * * *")
7758
@async begin
7859
println("Waiting… ", now(UTC))
79-
wait(c; tz=UTC)
60+
wait(cron; tz=UTC)
8061
println("Triggered at ", now(UTC))
8162
end
8263
```
@@ -104,15 +85,6 @@ Twice a month: 1st and 15th at 06:30 (Apr/Oct)
10485
cron = Cron("30 6 1,15 4,10 *") # Apr/Oct 1st and 15th at 06:30
10586
```
10687

107-
Get the next time from an arbitrary point
108-
```julia
109-
using Crontab, Dates
110-
111-
c = Cron("*/5 * * * *")
112-
113-
next(c, DateTime("2025-01-01T12:03:00")) # => 2025-01-01T12:05:00
114-
```
115-
11688
Example of running tasks asynchronously on cron schedules
11789
```julia
11890
using Dates

docs/src/index.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,12 @@ cron = Cron("*/5 * * * *")
2929
prev_time = prev(cron, DateTime("2025-01-01T12:03:00")) # 2025-01-01T12:00:00
3030
```
3131

32-
Compute next match offset-style (not chrono-style)
33-
```julia
34-
cron = Cron("*/5 * * * *")
35-
next_offset_time = next_offset(cron, DateTime("2025-01-01T12:03:00")) # 2025-01-01T12:08:00
36-
```
37-
3832
Generate 4 upcoming triggers strictly after a start time
3933
```julia
4034
cron = Cron("*/5 * * * *")
4135
ts = timesteps(cron, DateTime("2025-01-01T12:03:00"), 4) # 12:05, 12:10, 12:15, 12:20
4236
```
4337

44-
Create infinite offset-based iterator from starting point
45-
```julia
46-
cron = Cron("*/5 * * * *")
47-
start = DateTime("2025-01-01T12:07:00")
48-
xs = collect(take(gen_times(cron, start), 4))
49-
# [
50-
# DateTime("2025-01-01T12:12:00"),
51-
# DateTime("2025-01-01T12:17:00"),
52-
# DateTime("2025-01-01T12:22:00"),
53-
# DateTime("2025-01-01T12:27:00"),
54-
# ]
55-
```
56-
5738
Block until the next trigger (uses system clock) ie trigger once
5839
```julia
5940
cron = Cron("*/5 * * * *")
@@ -69,7 +50,7 @@ Trigger every minutes
6950
cron = Cron("*/1 * * * *")
7051
@async begin
7152
println("Waiting… ", now(UTC))
72-
wait(c; tz=UTC)
53+
wait(cron; tz=UTC)
7354
println("Triggered at ", now(UTC))
7455
end
7556
```
@@ -97,15 +78,6 @@ Twice a month: 1st and 15th at 06:30 (Apr/Oct)
9778
cron = Cron("30 6 1,15 4,10 *") # Apr/Oct 1st and 15th at 06:30
9879
```
9980

100-
Get the next time from an arbitrary point
101-
```julia
102-
using Crontab, Dates
103-
104-
c = Cron("*/5 * * * *")
105-
106-
next(c, DateTime("2025-01-01T12:03:00")) # => 2025-01-01T12:05:00
107-
```
108-
10981
Example of running tasks asynchronously on cron schedules
11082
```julia
11183
using Dates

0 commit comments

Comments
 (0)