ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decimal to Hex conversion


@altenbach wrote:

Easiest would be to just get minutes since Jan 1, 2000 and format in hex. 😄


Like timestamp mod 60? 

Correcting a typo minute of day is up to 1500 and takes 11 bits but still cheaper than 8 for MM and 5 for HH

 

Unmanipulated YYMMDDHHMM fits

 7+4+5+5+8 bits.  using Julian date and some YY overflow manipulation yields 6+9+5+8 using the Quotient times Remainder of Julian mod 366 to extend YY to 204 so the y2.1k bug becomes y2.204k visitin the trouble caused here onto your 7th generation offspring.   Minute of day goes to 6+9+11 


"Should be" isn't "Is" -Jay
0 Kudos
Message 31 of 39
(1,049 Views)

Aha, that 22 starts with a hex 5 or a sure sign YY uses 7 bits So, I'm fairly sure CA didn't use year in century+366+Julian+1500+minutes since midnight = compressed value and the inverse to stuff it all in 11bits with 79 values we could use to encode seconds, day of week, season and other parameters with.


"Should be" isn't "Is" -Jay
0 Kudos
Message 32 of 39
(1,039 Views)

Wow, this took off over the weekend.

 

I love it when we get to make up our own problems 😁.

 

I made up more interesting problems for myself atm though.

 

Would be nice if OP finally shared a reason behind this question?

Message 33 of 39
(1,018 Views)

It is used to create file nomenclature and versioning actually.

0 Kudos
Message 34 of 39
(1,001 Views)

@deep_217 wrote:

It is used to create file nomenclature and versioning actually.


That leaves so much to our imagination, it really raises more questions that it answers.

 

Why not simply store a date time string in the files?

0 Kudos
Message 35 of 39
(991 Views)

@deep_217 wrote:

It is used to create file nomenclature and versioning actually.


As I already guessed.

 

You should be fine using U64, but you might as well just use the original string. More readable! Why add complications and hamper human readability?

 

Having a one minute resolution is however a questionable choice. Computers (and users) are often capable of creating more than one version in a minute. 😮

0 Kudos
Message 36 of 39
(989 Views)

@deep_217 wrote:

It is used to create file nomenclature and versioning actually.


So why make it complicated?  Just use the Date/Time string and be done.  I personally use "%Y-%m-%d %H-%M-%S" as my time format.  It adds breaks between the parts to make it more readable for my users (especially those Quality Engineers).



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
Message 37 of 39
(981 Views)

It is SOP from my predecessors and obviously my plan B was to use decimal string, but, it wont be an accurate answer to this problem so needed second opinion to see if a solution is available.

0 Kudos
Message 38 of 39
(969 Views)

So why not use Number To Hexadecimal String and wire a 64 bit number to it? It is polymorphic, so it will work:

wiebeCARYA_0-1649145011620.png

 

Are there details in the SOP? "Time to Hex" can be interpreted in many, many ways.

0 Kudos
Message 39 of 39
(951 Views)