The name of the "Get Date/Time in Seconds” function is misleading. The function should be renamed.
Details
- The current name does not make it clear which Date/Time it is going to return. The words "now" or "current" are missing.
- The "In Seconds" portion is misleading and unnecessary. The function correctly returns a timestamp data type. The timestamp represents a moment in time that is expressed not just in seconds, but also using lots of other time units such as days, hours, minutes, ms, us, ns, etc. I understand that when a timestamp is converted to a DBL, the value represents the fractional number of seconds since the beginning of the epoch, but this is an implementation detail. It should not be part of the name of the function.
- “Get Date/Time in Seconds” would be a suitable name for a conversion function that takes in a formatted Date/Time string and outputs a DBL that represents the number of seconds since the beginning of the epoch.
Names of equivalent functions in other languages
- .NET: System.DateTime.Now
- C++: std::chrono::system_clock::now()
- Python: datetime.now()
Notice that the equivalent function names contain the word "now" and omit "in seconds".
Perhaps the best new name for the function would be “Get Date/Time Now”. This name would be very much in line with the .NET, C++ and Python equivalent function names. This name would earn the "let's not reinvent the wheel" prize.
Nevertheless, I would be happy with the following names too:
- “Get Timestamp Now”
- “Get Current Date/Time”
- “Get Current Timestamp”
Notes
- Changing a primitive name may break VIs that use VI scripting to find or create this node. This is a downside. I believe that in this case the long-term benefits would outweigh the relatively minor annoyance of hopefully relatively few developers having to modify those scripting VIs to use the new primitive name.