Talk:Convert seconds to compound duration: Difference between revisions

m
→‎possible optional or extra credit: added some comments and musings.
m (→‎possible optional or extra credit: added some comments and musings.)
Line 39:
:::* years (and centuries) might be something of a problem because the relation between weeks and years is not simple. But it would be doable if the task defined a year as (for example) 52.1786 weeks. The numbers would be a bit nonsensical, but the other option would be be that you have to specify the starting second. And if you are going to do that you might as well do months as well (but this of course changes the task into something very different - see also [[Talk:Holidays_related_to_Easter]] and [[Talk:Last_Friday_of_each_month]] for some of the issues which might be relevant for that kind of a task.
:::* Negative seconds might also change the task, if you wanted to go there. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 19:35, 20 June 2015 (UTC)
 
-----
 
As for that   '''0'''   seconds be displayed as an empty string --- well, the task's requirements are for using a   ''positive''   integer (for the input), and zero isn't a positive integer.   '''But''', if zero '''is''' specified, displaying no output is deceiving.   I chose to display a value in that non-conforming case.   Another solution would be to display an error message (indicating that a non-positive integer was specified), but that seems a cheap way out in handling the case of zero seconds.   I see nothing wrong with a zero-value (input) time unit being handling for this Rosetta Code task.   But, specs are specs.
 
I've been thinking about adding my full-blown, handy-dandy, fancy-dancy, general-purpose, all-inclusive, all-encompassing time (units) converter (to be saved/stored in it's own Rosetta Code page, it has over 600 lines of statements, not counting the documentation, which has almost 500 lines --- if I'm known for anything, it's robust documentation)   that does exactly what this Rosetta Code task addresses, including the somewhat unconventional abbreviations   (although it pluralizes the time units specified if appropriate).   My REXX program lets the user choose what time units (note the plural) to be used (for input as well as output).   Both the input time units (default time unit is in seconds if no time units is/are specified), and the output time units can also be specified, the default output times units are:
::* eon, millennium, century, year, month, day, hour, minute, second
(all are pluralized if necessary).
 
Also, the input time units can be additive or subtractive, as:
::*   2day-2.5001hrs+1week+2days+0fortnights
and almost all forms of abbreviations (and alternative spellings) are accepted:
 
::*   PLanck PLancks PLank PLanks PLANCKTIMe ...
::*   Year Years Yr Yrs
 
where the capital letters indicate the minimum abbreviation(s).
 
The user can also specify which time units to be used for the output, so that can (may?) solve the problem/issue with the   ''not''   using of months or weeks, --- as a month isn't exactly defined and most people are used to (roughly) 30 days per month, and (roughly) 52 weeks a year.   If desired, weeks and months can be "skipped" and just use years, days, hours, ...   or whatever time units are desired.
 
Whatever the last time unit is specified for the output, that time unit would/could contain a fractional value (say, if minutes and/or seconds were NOT specified for (in) the output time units.
 
Among other things, the REXX program supports things like the time for any planet's orbit time (or ''year'')   and converting it into whatever time unit(s) are specified (or use the defaults).   There are over 170 different time units supported ('''not''' counting the using of 42 metric and/or binary multipliers such as:   mega, kilo, giga, kibi, micro, nano, femto,   yadda, yadda, yadda).
 
Yuppers.   174 time units.   Who'd thunk it?   -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 20:58, 20 June 2015 (UTC)