Imprimir

# Calculator blog

## Time functions for HP Prime

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?

Leer mensaje completo
Más sobre:

## New time functions in HP Prime

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!