LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-23-2005, 03:32 PM   #1
ToBe
Member
 
Registered: Aug 2003
Distribution: RHEL 4&5 Ubuntu LTS 6.06 & 8.04, FreeBSD
Posts: 74

Rep: Reputation: 20
Start Date + Time Duration = End Date/Time calculator?


I am in need of a calculator where I could put in the date and time, and then enter the duration, and it'd output the ending date/time.

This is for several Linux backup servers I have in place. I use crontab to start my backup scripts to backup various servers.

I know the approximate sizes beforehand, and use a bandwidth calculator to estimate the times the backup will take.

My head is starting to hurt from manually calculating the end-time of my script execution, so a tool like this would help heaps!

Anyone seen anything that does this?

I've tried googling for it... seems Time is such a BROAD subject, I'm having trouble finding the proverbial needle

-Tim
 
Old 09-24-2005, 08:05 AM   #2
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
I doubt there would be something like that, but it shouldn't be too difficult to accomplish with a bash script or something. Enter the size and bandwidth, do the math to work out how many seconds it'll take and then generate a timestamp for the start time, plus the amount of seconds and generate a date string from the new timestamp. bash and bc can do the math, date can do the timestamp work
 
Old 09-24-2005, 02:43 PM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Actually, you're (probably) in luck ToBe. You already have a tool installed to do this: date

Pull up the man page if you don't believe me, or run a command like so:
Code:
$ date -d "2005-12-15 +5 hours +30 minutes"
Thu Dec 15 05:30:00 CST 2005
$ date -d "today +3 days +6 hours +15 minutes"
Tue Sep 27 20:56:00 CDT 2005
$ date -d "tomorrow +6123 seconds"
Sun Sep 25 16:23:55 CDT 2005
You can then modify the output to fit whatever format you need. Like I said, just pull up the man page and take a look at what's available.
 
Old 09-26-2005, 10:17 AM   #4
ToBe
Member
 
Registered: Aug 2003
Distribution: RHEL 4&5 Ubuntu LTS 6.06 & 8.04, FreeBSD
Posts: 74

Original Poster
Rep: Reputation: 20
WOW!

That date trick is exactly what I need. THANKS!!!

Great Tip
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
date and time osheasf Linux - Software 1 06-15-2005 07:47 AM
start date and start time of a process - jiffies Yoko Programming 0 12-04-2004 08:12 AM
Display the date and time from another time zone lothario Linux - Software 4 07-31-2004 03:27 PM
Date and Time mairul Debian 7 12-25-2003 12:26 PM
Date and time. vexer Slackware 2 08-13-2003 10:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration