Skip to content

Add comment explaining unusual choice of Australia/Sydney as default timezone#28607

Merged
rtyley merged 1 commit intomainfrom
add-comment-explaining-unusual-choice-of-default-timezone
Feb 13, 2026
Merged

Add comment explaining unusual choice of Australia/Sydney as default timezone#28607
rtyley merged 1 commit intomainfrom
add-comment-explaining-unusual-choice-of-default-timezone

Conversation

@rtyley
Copy link
Member

@rtyley rtyley commented Feb 13, 2026

Grant Klopper first made this change to the Frontend codebase in June 2014 with #4713 - he explained:

"dev machines will now run in a far away timezone so it is more obvious when you get a timezone wrong"

With the wonderful work to drop the custom sbt script in #28599 in January 2026, we weren't sure (#28599 (comment)) if we could keep the helpful comment explaining why the timezone was used - can the .jvmopts file, where the setting now lives, accept comments!?

How does sbt parse .jvmopts?

It turns out sbt takes the input from .jvmopts here, calling $(loadConfigFile .jvmopts) - the loadConfigFile() function reads in each line of the file, and crucially calls eval on it:

eval echo $line

eval is a built-in Linux command:

"The eval utility shall construct a command by concatenating arguments together, separating each with a <space>. The constructed command shall be read and executed by the shell."

The upshot is that this line of input:

-Duser.timezone=Australia/Sydney # because it is too easy for devs

...becomes the shell evaluation of:

echo -Duser.timezone=Australia/Sydney # because it is too easy for devs

...which as far as the shell is concerned, is just:

echo -Duser.timezone=Australia/Sydney

...so we are allowed comments!

This behaviour was added to the sbt launcher script with this commit in June 2013, as part of sbt/sbt#6458.

We can double-check it works by running sbt -v to see the arguments the launcher script passed to Java:

% sbt -v
[sbt_options] declare -a sbt_options='()'
[process_args] java_version = '11'
[copyRt] java9_rt = '/Users/roberto_tyley/.sbt/1.0/java9-rt-ext-amazon_com_inc__11_0_22/rt.jar'
# Executing command line:
java
-Xmx8G
-XX:ReservedCodeCacheSize=128m
-XX:NewRatio=4
-Duser.timezone=Australia/Sydney
-DSTAGE=DEV
-DAPP_SECRET=this_is_not_a_real_secret_just_for_tests
-Dsbt.script=/opt/homebrew/Cellar/sbt/1.12.0/libexec/bin/sbt
-Dscala.ext.dirs=/Users/roberto_tyley/.sbt/1.0/java9-rt-ext-amazon_com_inc__11_0_22
-jar
/opt/homebrew/Cellar/sbt/1.12.0/libexec/bin/sbt-launch.jar

[info] welcome to sbt 1.12.2 (Amazon.com Inc. Java 11.0.22)

…t timezone

Grant Klopper first made this change to the Frontend codebase in June 2014 with
#4713 - he explained:

> "dev machines will now run in a far away timezone so it is more obvious when you get a timezone wrong"

With the wonderful work to drop the custom `sbt` script in #28599
in January 2026, we weren't sure (#28599 (comment))
if we could keep the helpful comment explaining why the timezone was used - can the `.jvmopts` file, where
the setting now lives, accept comments!?

It turns out `sbt` takes the input from `.jvmopts` here, calling `$(loadConfigFile .jvmopts)`:

https://github.com/sbt/sbt/blob/v1.12.2/sbt#L869

The `loadConfigFile()` function reads in each line of the file, and crucially calls `eval` on it:

```
eval echo $line
```

https://github.com/sbt/sbt/blob/v1.12.2/sbt#L771

The definition of `eval` is:

> "The eval utility shall construct a command by concatenating arguments together, separating each with a <space>. The constructed command shall be read and executed by the shell."

The upshot is that this line of input:

```
-Duser.timezone=Australia/Sydney # because it is too easy for devs
```

...becomes the shell evaluation of:

```
echo -Duser.timezone=Australia/Sydney # because it is too easy for devs
```

...which as far as the shell is concerned, is just:

```
echo -Duser.timezone=Australia/Sydney
```

...so we _are_ allowed comments!

This behaviour was added to the sbt launcher script with this commit in
June 2013, as part of sbt/sbt#6458:

sbt/sbt@1835225

We can double-check it works by running `sbt -v` to see the arguments the launcher script passed to Java:

```
% sbt -v
[sbt_options] declare -a sbt_options='()'
[process_args] java_version = '11'
[copyRt] java9_rt = '/Users/roberto_tyley/.sbt/1.0/java9-rt-ext-amazon_com_inc__11_0_22/rt.jar'
# Executing command line:
java
-Xmx8G
-XX:ReservedCodeCacheSize=128m
-XX:NewRatio=4
-Duser.timezone=Australia/Sydney
-DSTAGE=DEV
-DAPP_SECRET=this_is_not_a_real_secret_just_for_tests
-Dsbt.script=/opt/homebrew/Cellar/sbt/1.12.0/libexec/bin/sbt
-Dscala.ext.dirs=/Users/roberto_tyley/.sbt/1.0/java9-rt-ext-amazon_com_inc__11_0_22
-jar
/opt/homebrew/Cellar/sbt/1.12.0/libexec/bin/sbt-launch.jar

[info] welcome to sbt 1.12.2 (Amazon.com Inc. Java 11.0.22)
```
Copy link
Contributor

@alexduf alexduf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful!

@rtyley rtyley marked this pull request as ready for review February 13, 2026 11:10
@rtyley rtyley requested a review from a team as a code owner February 13, 2026 11:10
@rtyley rtyley mentioned this pull request Feb 13, 2026
@rtyley rtyley added the maintenance Departmental tracking: maintenance work, not a fix or a feature label Feb 13, 2026
@rtyley rtyley merged commit e86ae9e into main Feb 13, 2026
11 of 13 checks passed
@rtyley rtyley deleted the add-comment-explaining-unusual-choice-of-default-timezone branch February 13, 2026 11:13
@gu-prout
Copy link

gu-prout bot commented Feb 13, 2026

Seen on FRONTS-PROD, ADMIN-PROD (merged by @rtyley 14 minutes and 32 seconds ago)

@SiAdcock
Copy link
Contributor

Ha amazing, thanks @rtyley 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Departmental tracking: maintenance work, not a fix or a feature Seen-on-ADMIN-PROD Seen-on-FRONTS-PROD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants