LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Petru_Tarabuta

The “Get Date/Time in Seconds” function should be renamed to “Get Date/Time Now”

Status: New

The name of the "Get Date/Time in Seconds” function is misleading. The function should be renamed.

Combined v2.png

 

 

 

 

 

 

 

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.
7 Comments
crossrulz
Knight of NI

Of your options, I would go with "Get Current Timestamp".  I agree that the "in Seconds" is weird to me since the output is a timestamp.  So I think it would clear some confusion if Timestamp was in the name.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
wiebe@CARYA
Knight of NI

There was a time, not even that long ago, when timestamps weren't there (LV7: Time stamp - LabVIEW Wiki). 

 

"In Seconds" was used to explicitly distinguish the time in the brand new function from the "in ms" of the existing time function(s).

 

Not a great name for a function. It made some sense way back then (~2000?), but not anymore.

 

A good name should be timeless 😎.

fefepeto_kb
Member

>>>Names of equivalent functions in other languages

  • .NET: System.DateTime.Now
  • C++: std::chrono::system_clock::now()
  • Python: datetime.now()

Might sound nitpick, but I would prefer to be explicit about the result being the system time. As the above example shows 2 of 3 languages (if we include Rust 3 out of 4) include this. This might help distinguish the function from an implementation specific function with similar name in one's class.

Yamaeda
Proven Zealot

@wiebe "There was a time, not even that long ago" - LV7 released over 20 years ago. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
wiebe@CARYA
Knight of NI

>@wiebe "There was a time, not even that long ago" - LV7 released over 20 years ago. 

 

👴

 

 

wiebe@CARYA
Knight of NI

I'm a bit hesitant about this because:

a) I'm used to it;

b) (scripting) tools might fail;

c) the reward isn't that big.

 

On it's own it is an improvement though.

_carl
Member

Definitely giving you a kudos for this!

 

I don't need this VI very often, but when I do, it goes something like this:

- Open up Quick Drop and type in "now" looking for this VI -- because that's what it's called in other languages!

- Give up (because "now" doesn't return anything useful), and drill through the functions palette

- Skip over this VI because of the poorly named "in seconds" portion (making me think it'll return a numeric of seconds-since-a-mystery-date, or a timestamp with 1-second resolution), before eventually circling back to it and realizing it's the VI I'm looking for. But I first test it out in a new VI just to make sure it actually returns a full resolution timestamp.