Time Calculator -SOLVED

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
WHVW
Level 4
Level 4
Posts: 268
Joined: Tue May 19, 2015 4:31 pm

Time Calculator -SOLVED

Post by WHVW » Wed Mar 07, 2018 8:29 pm

Hi All:
Does anyone out there know of a programme that will allow you to calculate timings? That is, for example: 17:36 + 7:39=?

Thanks.
Last edited by WHVW on Sat Mar 24, 2018 12:23 pm, edited 1 time in total.

User avatar
BenTrabetere
Level 5
Level 5
Posts: 770
Joined: Sat Jul 19, 2014 12:04 am
Location: Hattiesburg, MS USA

Re: Time Calculator

Post by BenTrabetere » Wed Mar 07, 2018 10:36 pm

Take a look at Qalculate. You set the Base Number to Time format. It is under the Mode on the menu bar. It can be installed from Software Manager. It is an earlier version, but it works just fine. The newer version is an improvement. http://qalculate.github.io/index.html

I did not feel like the newer version from source, so I installed the snap. You can find an installer here https://snapcraft.io/qalculate.

Cosmo.
Level 23
Level 23
Posts: 17824
Joined: Sat Dec 06, 2014 7:34 am

Re: Time Calculator

Post by Cosmo. » Thu Mar 08, 2018 6:24 am

LibreOffice Calc can do this. In cases lake this you need to format the cells in a way, that also the date gets displayed, otherwise the result (1:15) looks strange.

elixxx
Level 2
Level 2
Posts: 76
Joined: Sat Oct 19, 2013 1:19 pm

Re: Time Calculator

Post by elixxx » Thu Mar 08, 2018 4:16 pm

bash can do magic as well :)

Code: Select all

date -u -d "17:36 - 7:39" +"%H:%M"

WHVW
Level 4
Level 4
Posts: 268
Joined: Tue May 19, 2015 4:31 pm

Re: Time Calculator

Post by WHVW » Thu Mar 08, 2018 8:43 pm

Hi:

Thanks for all the info, but in practical terms the answer seems to be "No".
Qalculate will not install, no matter what I do. Even the "sudo snap install qalculate" will not work, my system cannot understand "snap". The other methods will not work, either.
I tried the terminal approach, a bit clumsy for on the fly work, but it would be a lot better than nothing, but no-go. It seems made for dates, not adding/calculating musical timings as I need to do.
It would seem that Libre Office's function (from what Cosmo says) is also centred around dates too.
Why I asked about the calculator format is because I need something relatively fast, for use while on the air.

Thanks, all.

User avatar
all41
Level 13
Level 13
Posts: 4987
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Time Calculator

Post by all41 » Fri Mar 09, 2018 12:22 am

Code: Select all

apt install qalculate
works!
Proud to be a supporter and monthly contributor to Mint.

User avatar
BenTrabetere
Level 5
Level 5
Posts: 770
Joined: Sat Jul 19, 2014 12:04 am
Location: Hattiesburg, MS USA

Re: Time Calculator

Post by BenTrabetere » Fri Mar 09, 2018 2:37 am

WHVW wrote:
Thu Mar 08, 2018 8:43 pm
It would seem that Libre Office's function (from what Cosmo says) is also centred around dates too.
You can get around the date and AM/PM nuisance by formatting the cells as [HH]:MM:SS. That is 876613:37:46 in the Format Cells>Time listing. You must enter the durations as Hours:Minutes:Seconds; e.g. 0:3:10

It works most of the time, and I have a work around that uses the timevalue function for the times it has not worked for me in the past.

I find Gnumeric does a better job of adding duration, especially if you are only working with Minutes and Seconds. It has a mm:ss format, which eliminates the need for the zero hours nonsense. If you are adding a lot of time values and there is a chance the total will be greater than 60-minutes, you can format that cell as [h]:mm:ss to get a 1:03:30 instead of 183:30.

User avatar
phd21
Level 17
Level 17
Posts: 7500
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Time Calculator

Post by phd21 » Fri Mar 09, 2018 12:38 pm

Hi WHVW,

I just read your post and the good replies to it. Here are my thoughts on this as well.

What is the result that you are looking for?

+1 Qalculate, new update is a major improvement and installing it using the snap package was a snap. KDE users also have a widget for this...
Qalculate is a Powerful Calculator For Linux
https://www.maketecheasier.com/qalculat ... for-linux/

Time Calculator
https://www.timecalculator.net/

Epoch Converter - Unix Timestamp Converter
https://www.epochconverter.com/

Hope this helps ...
Phd21: Mint KDE 18.3 & 19, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram,256gb SDD, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

FreedomTruth
Level 4
Level 4
Posts: 418
Joined: Fri Sep 23, 2016 10:19 am

Re: Time Calculator

Post by FreedomTruth » Fri Mar 09, 2018 8:21 pm

WHVW wrote:
Wed Mar 07, 2018 8:29 pm
Does anyone out there know of a programme that will allow you to calculate timings? That is, for example: 17:36 + 7:39=?

Code: Select all

dc -e '0 k 17 60 * 36 + 7 60 * 39 + + 60 ~ r f q'|(read min; echo -n $min:; read sec; echo $sec)
25:15
If you abide in My word, you are My disciples indeed. And you shall know the truth, and the truth shall make you free... Most assuredly, I say to you, whoever commits sin is a slave of sin... Therefore if the Son makes you free, you shall be free indeed.

WHVW
Level 4
Level 4
Posts: 268
Joined: Tue May 19, 2015 4:31 pm

Re: Time Calculator

Post by WHVW » Fri Mar 09, 2018 9:25 pm

Hi All:

phd21: This is what I am trying to achieve: a relatively fast way to determine if I have enough time to play a multi-part selection (such as a symphony) in the amount of time I have left, (and) how much time (if any) will be left over.
Many records and CD's print individual timings, but omit the total. So you might have: Movement 1-15:47, Movement 2-8:03, Movement 3-22:13 and Movement 4-17:17. Doing it in your head with all the other distractions you face oftimes leads to errors in math: -no good. So I need a calculator display-style programme that understands that 1:00 comes after :59 so I can quickly and accurately add up the timings without cumbersome set-ups.
I used to have a physical calculator from Radio Shack (of all places!) that did just that, but it disappeared in the sands of time.

All41's "apt install qalculate" looks like a good approach, I will try that after I fix another problem with this computer that just re-emerged.

Thank you all for your ideas.

lmuserx4849

Re: Time Calculator

Post by lmuserx4849 » Fri Mar 09, 2018 11:22 pm

It's not a gui, but the date command is super powerful and doesn't require anything special. It can also be used in a bash script.

Code: Select all

# Add 7 mins and 39 seconds to a given date
# Short option format: -d  Long option format: --date=

date -d '2018-03-09 17:36 CST + 7 mins 39 sec'

# Same as above (7*60+39)

date -d '2018-03-09 17:36 CST + 459 sec'

# change output format

date --date='2018-03-09 17:36 CST + 7 mins 39 sec'  '+%Y-%m-%d %H:%M:%S %z'

# Add to current time

date -d '+ 459 sec'

Examples of date at the gnu.org site.
This html documentation is actually the info documentation that is installed on all linux systems. I read info like, info date | less, rather using the info command itself.

Save the script below, chmod permissions and run. If the script is in a directory that is in your PATH (echo $PATH), then you don't need "./". "./" means current directory. If you aren't in the directory where the script resides, you need to use the full path to the script.

===> ./newtime.sh 15:47 8:03 22:13
Fri, Mar 09, 2018 10:54:11 PM

Code: Select all

#!/bin/bash
declare -a times=("$@")    # command line input - space separated list of mins:secs
declare -r regexMinSec='^[[:digit:]]+:[[:digit:]]+$'    # regex to validate above input
declare -- t=''    # one mm:ss input
declare -- seconds=0    # all minutes and seconds added up

display_help() { printf -- 'Please enter a space separated list of mins:secs\n'; }

# was data entered on the command line
if (( ${#times[@]} == 0 )); then
  display_help
  exit 0
fi

# loop through command line input
for t in ${times[@]}; do

  # valid input
  if [[ ! ${t} =~ ${regexMinSec} ]]; then
    printf -- 'Invalid time format found - [%s]\n' "${t}"
    display_help
    exit 1
  fi

  # take the minute part before the colon and seconds part after the colon and add
  (( seconds+=${t%%:*}*60, seconds+=${t##*:} ))

done

# see man date for additional formats
date --date "+${seconds} seconds" '+%a, %b %d, %Y %r'

User avatar
phd21
Level 17
Level 17
Posts: 7500
Joined: Thu Jan 09, 2014 9:42 pm
Location: Florida

Re: Time Calculator

Post by phd21 » Sat Mar 10, 2018 3:07 pm

Hi WHVW,

I was thinking about your request. This may not be a time calculator option, but I think a lot of music applications will do this for you, if you create a playlist of what you want to listen to. I also think the superb "K3b" DVD/CD application will give you a total of any tracks and discs you add to a project.

Just a thought...
Phd21: Mint KDE 18.3 & 19, 64-bit Awesome OS, Ancient Dell OptiPlex 780 Core2Duo E8400 3GHz,4gb Ram,256gb SDD, Video: Intel 4 Graphics, DVD Lightscribe. Why I use KDE?:https://opensource.com/life/15/4/9-reasons-to-use-kde

User avatar
nicolesharp100
Level 1
Level 1
Posts: 5
Joined: Mon Mar 12, 2018 8:55 am
Location: Cumberland, Maryland, United States of America
Contact:

Re: Time Calculator

Post by nicolesharp100 » Mon Mar 12, 2018 9:41 am

For simple calculations, I just use WXMaxima for this (Maxima from Terminal shown below). For anything more complex, you might be better off with LibreOffice Calc.

nicole@nikkidesk ~ $ maxima

Maxima 5.37.2 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) float(17+(36/60)+7+(39/60));
(%o1) 25.25
(%i2) minutes:25;
(%o2) 25
(%i3) %o1-minutes;
(%o3) 0.25
(%i4) %o3*60;
(%o4) 15.0
(%i5) seconds:15;
(%o5) 15
(%i6)

WHVW
Level 4
Level 4
Posts: 268
Joined: Tue May 19, 2015 4:31 pm

Re: Time Calculator

Post by WHVW » Sat Mar 24, 2018 12:23 pm

Hi:

I tried "apt install qalculate" and that worked.
I can see that it will do what I want, even if it's process is a bit opaque. One interesting thing it can do is math in Roman numerals, which I do find intriguing. When I get it's process figured out it will work, well, King, it looks like this case is closed!

lmuserx4849

Re: Time Calculator

Post by lmuserx4849 » Sun Mar 25, 2018 2:59 am

WHVW wrote:
Sat Mar 24, 2018 12:23 pm
Hi:

I tried "apt install qalculate" and that worked.
I can see that it will do what I want, even if it's process is a bit opaque. One interesting thing it can do is math in Roman numerals, which I do find intriguing. When I get it's process figured out it will work, well, King, it looks like this case is closed!
Roman numerals :-) Jimmy Kimmel Against Super Bowl Roman Numerals. When I get bored I convert number between bases (hex, binary, octal, decimal) :-)

I'm on 17.3 and qalculate in the repos is pretty old. The About Box says 2006 and the repo says 0.9.7. Did you install from the repo or download it?

WHVW
Level 4
Level 4
Posts: 268
Joined: Tue May 19, 2015 4:31 pm

Re: Time Calculator -SOLVED

Post by WHVW » Wed Mar 28, 2018 8:02 pm

lmuserx4849:

Mine is 0.9.7 also.
I will not be shy about admitting that I have oh so much to learn.... but I think that because I used "apt install qalculate" to obtain the programme, it means that it came from a repository. Hopfully, if I am wrong about that, someone will correct me.

Thanks.

Post Reply

Return to “Software & Applications”