Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Duration unit constants to quiver.time #91

Closed
seaneagan opened this issue Feb 14, 2014 · 5 comments · Fixed by #93
Closed

Add Duration unit constants to quiver.time #91

seaneagan opened this issue Feb 14, 2014 · 5 comments · Fixed by #93

Comments

@seaneagan
Copy link
Contributor

Constants:

const Duration microsecond = const Duration(microseconds: 1);
const Duration millisecond = const Duration(milliseconds: 1);
const Duration second = const Duration(seconds: 1);
const Duration minute = const Duration(minutes: 1);
const Duration hour = const Duration(hours: 1);
const Duration day = const Duration(days: 1);
const Duration week = const Duration(days: 7);
const Duration year = const Duration(years: 1);

Usage:

if(stopwatch.elapsed > minute) ...

new Timer(millisecond * 500, () {...});

var inOneDay = clock.now().add(day);
@justinfagnani
Copy link
Contributor

Part of me really wants there to be a "one" or "a" prefix... @yjbanov ?

@yjbanov
Copy link
Member

yjbanov commented Feb 14, 2014

The part of me that likes shorter variable names has knocked the other part unconscious :)

@yjbanov yjbanov closed this as completed Feb 14, 2014
@yjbanov yjbanov reopened this Feb 14, 2014
@yjbanov
Copy link
Member

yjbanov commented Feb 14, 2014

Sorry for the churn. I'm clicking on buttons too randomly this morning.

@seaneagan
Copy link
Contributor Author

I do think it reads much better with the 'a' / 'an' prefix. It also keeps them co-located in the docs, and is less likely to conflict with e.g. var day = dateTime.day. But I can switch it back if needed.

@yjbanov
Copy link
Member

yjbanov commented Feb 15, 2014

A very practical observation. A prefix SGTM then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants