05-01-2010
Dear Tyler
I have managed to install perl and DateCalc on Windows...I also installed Cygwin and i am able to run your code.
Thanks a lot for your help.
Regards
Sampy
Last edited by ssantoshss; 05-03-2010 at 05:49 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
Im writing a script using the ksh shell. I have 2 variables in the script:
CURRTIME
PREVTIME
Example, if CURRTIME=13:00, I want to somehow calculate what the time was an hour ago so that PREVTIME=12:00
Right now I have the following:
CURRTIME=`date +%H:%M`
How can I... (4 Replies)
Discussion started by: xadamz23
4 Replies
2. Shell Programming and Scripting
i have the time 20100421043335 in format (date +%Y%m%d%H%M%S),and i want to be able to get the previous time 2 minutes ago,which is
20100421043135 (9 Replies)
Discussion started by: tomjones
9 Replies
3. Shell Programming and Scripting
Hi guys.
I am trying to subtract 10 minutes from the current Unix system date and time. I have the datecalc provided here but it is mainly the date and not the time. Please check on how can i subtract 10 minutes from the current time using datecalc or any other shell scripting that will... (2 Replies)
Discussion started by: bantiloe
2 Replies
4. Shell Programming and Scripting
HI Guys,
I want to find out the script running time and subtract from sleeptime.
My Script Below Give me error :-
#!/usr/bin/ksh
timeout=100
start=$SECONDS
sleep 20
end=$SECONDS
echo "Time: $((end - start)) "
ScTime = $((end - start)) (1 Reply)
Discussion started by: asavaliya
1 Replies
5. Shell Programming and Scripting
Hello all,
I have written sth like this:
#!/bin/bash
grep -e XXX -e YYYY myfile.log | grep -v ZZZ | awk '{print $1 " " $2 ";" $3 ";" $9 ";" $11}' > myfile.csv
sed -i '1iDate;Time;From;To' myfile.csv
=> it is clear that it converts log to csv and add a header.
Now I want to subtract row... (4 Replies)
Discussion started by: frhling
4 Replies
6. Shell Programming and Scripting
Hello,
I am writing a script to find time difference between two timestamp stored in a variable.
i have two variable
t1=11:48:30
t2=13:13:48
how i can find the difference i.e t2-t1 in seconds.
Please help (4 Replies)
Discussion started by: anand2308
4 Replies
7. Shell Programming and Scripting
Hello All,
I am working on script where I need to add hours,minutes or seconds in the time.Time is not the current but it could be future time.I thought I can store that time in variable and add hours.minutes or second but I am not able to add that in the time that is stores in a variable.
Time... (9 Replies)
Discussion started by: anuragpgtgerman
9 Replies
8. Shell Programming and Scripting
the given time is:
12:13:00
how do i subtract a 10 minutes from any given time?
date '12:13:00' '-10 min'
also tried this:
date +12:13:00 '-10 min' (2 Replies)
Discussion started by: SkySmart
2 Replies
9. UNIX for Dummies Questions & Answers
Hello All ,
Please support for below request
how to change format and subtract time and date and get average.
xxx 13-OCT-15 11.32.18.241000 AM 13-OCT-15 11.35.49.089080 AM
xxx 13-OCT-15 11.32.24.000000 AM 13-OCT-15 11.45.17.810904 AM
xxx 13-OCT-15 11.32.25.232000 AM ... (1 Reply)
Discussion started by: mirwasim
1 Replies
10. Shell Programming and Scripting
INPUT:
16:45:51 10051 77845
16:45:51 10051 77845
16:46:52 10051 77846
16:46:53 10051 77846
Match the last PID then subtract second line time with first line.
Please help me with any command or script. (3 Replies)
Discussion started by: vivekn
3 Replies
LEARN ABOUT DEBIAN
test::mocktime::datecalc
Test::MockTime::DateCalc(3pm) User Contributed Perl Documentation Test::MockTime::DateCalc(3pm)
NAME
Test::MockTime::DateCalc -- fake time for Date::Calc functions
SYNOPSIS
use Test::MockTime;
use Test::MockTime::DateCalc; # before Date::Calc loads
# ...
use My::Module::Using::Date::Calc;
DESCRIPTION
"Test::MockTime::DateCalc" arranges for the functions in "Date::Calc" to follow the Perl level "time" function (see perlfunc), and in
particular any fake date/time set there by "Test::MockTime". The following "Date::Calc" functions are changed
System_Clock
Today
Now
Today_and_Now
This_Year
Gmtime
Localtime
Timezone
Time_to_Date
"Gmtime", "Localtime", "Timezone" and "Time_to_Date" are made to default to the Perl-level current "time". When called with an explicit
time argument they're unchanged.
Module Load Order
"Test::MockTime" or similar fakery must be loaded first, before anything with a "time()" call, which includes "Test::MockTime::DateCalc".
This is the same as all "CORE::GLOBAL" overrides, see "OVERRIDING CORE FUNCTIONS" in CORE.
"Test::MockTime::DateCalc" must be loaded before "Date::Calc". If "Date::Calc" is already loaded then its functions might have been
imported into other modules and such imports are not affected by the redefinitions made. For that reason "Test::MockTime::DateCalc"
demands it be the one to load "Date::Calc" for the first time. Usually this simply means having "Test::MockTime::DateCalc" at the start of
a test script, before the things you're going to test.
use strict;
use warnings;
use Test::MockTime ':all';
use Test::MockTime::DateCalc;
use My::Foo::Bar;
set_fixed_time('1981-01-01T00:00:00Z');
is (My::Foo::Bar::something(), 1981);
restore_time();
In a test script it's often good to have your own modules early to check they correctly load their pre-requisites. You might want a
separate test script for that so you don't accidentally rely on "Test::MockTime::DateCalc" loading "Date::Calc" for you.
Other Faking Modules
"Test::MockTime::DateCalc" can be used with other modules which mangle the Perl-level "time" too. For example "Time::Fake",
use Time::Fake; # fakery first
use Test::MockTime::DateCalc;
Or "Time::Mock",
use Time::Mock; # fakery first
use Test::MockTime::DateCalc;
"Time::Warp" (as of version 0.5) only exports a new "time", it's not a core override and so can't be used with "Test::MockTime::DateCalc".
SEE ALSO
Date::Calc, Test::MockTime, Time::Fake, Time::Mock
faketime(1)
HOME PAGE
http://user42.tuxfamily.org/test-mocktime-datecalc/index.html
COPYRIGHT
Copyright 2009, 2010 Kevin Ryde
Test-MockTime-DateCalc is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3, or (at your option) any later version.
Test-MockTime-DateCalc is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Test-MockTime-DateCalc. If not, see
<http://www.gnu.org/licenses/>.
perl v5.10.1 2010-09-15 Test::MockTime::DateCalc(3pm)