Musings and comments about our common interest

Publicado el por JGD
## Time functions for HP Prime

Leer mensaje completo

This time we’ll discuss the pure short term time functions, not the ones related with days between dates, day of the week, etc. We’ll discuss functions that return seconds of milliseconds.

Did you know that you could use the HP Prime as a stopwatch for your experiments in class? You have several functions that can do the trick.

On one side, you have the TICKS function. It returns the internal millisecond clock value. While this function is not exactly what you were looking in itself, the point here is that you can subtract the value of the function at two different moments in time, and you’ll get the number of milliseconds between these two moments. You can prepare a simple program where you launch a subroutine with an input function, that triggers the tick function and stores its result in a variable, and then you launch another in order to end, store the result in a different value, subtract both, divide by 1000 and you have the number of seconds between the two events that triggered the function.

There is another possibility, which is very neat: using the function TEVAL(). It returns the time in seconds that it takes to evaluate its argument. So, if the argument is a program you have created, that, for example, ends when you press a key, the function will return the number of seconds since you started it until you pressed a key. Neat, isn’t it?

Can any of you provide one of such small programs?

Más sobre:
HP prime, time functions

Publicado el por JGD
## New time functions in HP Prime

Leer mensaje completo

In these and other articles to come, we will discuss some of the new features of the new HP Prime firmware, numbered 7820.

(By the way, one of the things I look after each firmware update is the power consumption of the calculator. Not using a multimeter and seeing the the actual current demanded from the batteries in standby, running programs and dormant; but paying attention on how long it takes from consecutive charges. It is good to mention that it doesn’t consume more, but, if anything, batteries last longer now. Again, not a scientific measure)

Today we will talk about the new time functions. Prior to this release, there were several time-related functions, but pretty much low level, like reading the number of ticks from the internal clock. This has limited use for a normal user - it is much more aimed to the programmer that needs to time events in the program flow.

Now, let’s discuss the new time functions, starting with algebraic or txt book data entry format.

The new functions are:

**DDAYS(Date1, Date2).**

It calculates the number of days between two dates. The format is the more generic YYYY.MMDD (but equally odd for U.S. and European users). The use of either American or European date formats would have created the need for much more hassle; just take a look to what happens with the simpler decimal point or comma, and the separation of digits in number format. It actually make some functions and programs to fail. but then why are there here options for setting the date format in the setting pages? It seems that it only applies to the Prime’s right upper corner display!

It doesn’t have any of the options of the HP19bii or hp17bii namely, the ability to calculate in 360 and 365 days, as opposed to the more standard natural calendar. I like the fact that the same name used in the Hp41c’s time module has been used here.

Please remember than in RPN you need to put Date1 in level 2 of the stack, Date2 in level one and only then enter DDAYS and ENTER!

**DATEADD(Date, number of days)**

Adds the number of days to the date, returning the result in Prime’s date format (YYYY.MMDD). Here the name deviates from what is burned in my ROMs! It gives a single result, not showing the day of the week as many other hp calculators did. Same as above for RPN: enter first date, then days to add, then the function!

**DAYOFWEEK(Date)**

Well, pretty much self-explaining name. Again, the date has to be entered in YYYY.MMDD format. It returns a number, not a string. It takes the convention of calling “1” to Monday, and so forth. Same provisos as above for RPN: first date, ENTER, function name and ENTER again.

(While I was looking at Prime’s help system for these functions, I noticed that there was a menu item I had not seen before: “Other”. When clicking on it, I found it showed the other two functions of the lot, screen-selectable. That’s a clever device! I am looking forward to see other function families to see how the help system organizes them in like-sets.)

Más sobre:
HP prime, time functions