search for: time_now

Displaying 5 results from an estimated 5 matches for "time_now".

Did you mean: utime_now
2006 Nov 10
3
Stubbing Time.now in trunk
I''m a big fan of stubbing Time.now so it returns a known value. I used to be able to use stubba and say: @time_now = Time.parse("Jan 1 2001") Time.stubs(:now).returns(lambda{@time_now}) However, something in trunk broke that. Fine, rspec''s got its own stubbing lib now, so I tried switching to that: @time_now = Time.parse("Jan 1 2001") Time.stub!(:now).and_return(lambda{@time_now...
2009 Jan 26
4
Mocking/Stubbing ActiveRecord.config.default_timezone
...ng for some opinions on how to test for this sort of thing in a more general sense. At issue is the setting of config values in environment.rb files and their influence on user code. In the specific case I encountered this code demonstrates the essence of the situation: def active_row? time_now = DateTime.now return true if (effective_from <= time_now and (not superseded_after or superseded_after >= time_now )) return false end The error is that the time_now assignment is not testing whether or not the default AR time is utc. The correct code...
2019 Oct 03
2
[PATCH] Avoiding Dereferencing of NULL pointer
...b/moduli.c index 578fc48..c1fa484 100644 --- a/moduli.c +++ b/moduli.c @@ -153,12 +153,14 @@ static int qfileout(FILE * ofile, u_int32_t otype, u_int32_t otests, u_int32_t otries, u_int32_t osize, u_int32_t ogenerator, BIGNUM * omodulus) { - struct tm *gtm; + struct tm *gtm = NULL; time_t time_now; int res; time(&time_now); gtm = gmtime(&time_now); + if (!gtm) + return (-1); res = fprintf(ofile, "%04d%02d%02d%02d%02d%02d %u %u %u %u %x ", gtm->tm_year + 1900, gtm->tm_mon + 1, gtm->tm_mday, -- 2.7.4
2009 Jan 19
0
How to add SipAddHeader in outgoing call file.
...) [STD-callback-leg2] exten => s,1,NoOp(Entering callback-leg2) exten => s,2,Set(CALLERID(number)=${CallBackNo}) ;------ The Script Authorizes the user on Basis of Caller ID------------------ ;------ Plays an IVR, gets destination Phno in SIP_Dest variable ------------- exten => s,3,Set(TIME_NOW=${EPOCH}) exten => s,4,DeadAGI(STD/STD-CBLeg2-RadAuthAcc.pl|${confID}|${calltime}|${TIME_NOW}|${SIP_HEADER(Call-ID)}|${Leg1CallID}) exten => s,5,hangup() Regards, Asif
2009 Jan 16
2
want to add SipAddHeader in call out file
How to add SipAddHeader in outgoing call file. I am implementing a Callback scenario, in which a user makes a call to Local Access Number. The system have to callback to the user. During callback a call file is generated. All I want, is to add SipAddHeader("pchargingvector","val") in outgoing Invite. How can I achieve this? regards, Asif