Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-9283 - Allow timezone definition in scheduler
- Loading branch information
Showing
3 changed files
with
84 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
import java.text.DateFormat; | ||
import java.util.ArrayList; | ||
import java.util.Calendar; | ||
import java.util.TimeZone; | ||
import java.util.GregorianCalendar; | ||
import java.util.Locale; | ||
|
||
|
@@ -301,4 +302,17 @@ public int next(int n) { | |
// ok | ||
} | ||
} | ||
|
||
@Issue("JENKINS-9283") | ||
@Test public void testTimezone() throws Exception { | ||
CronTabList tabs = CronTabList.create("TZ=Australia/Sydney\nH * * * *\nH * * * *", Hash.from("seed")); | ||
This comment has been minimized.
Sorry, something went wrong.
bargemb
|
||
List<Integer> times = new ArrayList<Integer>(); | ||
for (int i = 0; i < 60; i++) { | ||
if (tabs.check(new GregorianCalendar(2013, 3, 3, 11, i, 0))) { | ||
times.add(i); | ||
} | ||
} | ||
assertEquals("[35, 56]", times.toString()); | ||
} | ||
|
||
} |
1 comment
on commit 6b4d044
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine having form validation for the TZ
values would be very useful.
@orrc
According to the code, TZ is being specified in the first line, which does not contain any other data. Hence the format would be: