If I were to have a text box for someone to enter an integer and dropdown list from which my user would select day(s), hour(s), minute(s) or second(s), is there a single word that would describe what is selected in the dropdown list. The best I can think of is "time unit", but was hoping for a single word to describe an arbitrary unit of time.
|
|
"Time unit" is correct here. "Duration" and similar terms refer to a slice of time (like two hours) not merely to the unit itself. Of course you may be able to simply leave the box unmarked -- if someone sees "days" in a dropdown they'll know what it's there for. |
|||||||||||
|
|
Since you mentioned that you're looking for an appropriate variable name: It sounds like the real purpose of this variable is to control the scale (order of magnitude) of the time interval. So why not "scale" or "scaleFactor"? This clearly conveys the relation it has to the other variable. |
|||
|
|
|
Time-span, timespan, or time span, maybe?
So, what you're left with is a unit of time, to what measurement is left for guessing. Or you could use unit of measurement, but again, this leaves quite a bit to the imagination of the reader - and who exactly going to be reading it? The user? Or other developers? Personally, I would choose what is going to be clearest to both, including to you in the future. If something represents a day, call it |
||||
|
|
|
How about "duration"? I think that'll work for you… |
|||
|
|
In this case, it really depends on the context. While there are single words that describe a unit of time, it depends on what you're using it for. For example, if you were making a program that would act as a timer, "duration" or "interval" would be a good choice. There are also cases where simply using "unit" may send the message across, because the user will know what kind of units are being used by looking at the options and the context of the field. Despite there being single words that may represent units of time, "unit of time" might be the best description in certain cases as well. Do not be afraid to use multiple words if it sounds better.
Where [2] and [seconds] are filled fields, with [seconds] being a drop-down box for the unit of time. |
|||
|
|
|
As you mention coming up with a variable name, perhaps you want to take a different approach entirely. Most drop down boxes us a combination of (Label, Value) pairs. In your original question you attempt to come up with a name for the Labels "day(s)", "hour(s)", "minute(s)" and "second(s)", but if you're seeking a variable name for use in your code perhaps you would really like a term which describes the values. For example, the values in your drop down box may be 86400, 3600, 60, 1. In which case the name SecondsPerUnit or UnitsToSeconds may be more appropriate. And a variable name describing the numeric portion of the time entered by the user could be "TimeInUnits". Thus it's clear your dimensions are correct when you write "Seconds = TimeInUnits * UnitsToSeconds". |
|||
|
|