Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Authorize.net timestamp wrong due to Daylight Savings

Posted on 2012-03-27
4
Medium Priority
?
786 Views
Last Modified: 2012-04-11
I have an e-commerce site that uses Authorize.net SIM Gateway for processing credit cards.  A unique fingerprint is created for each transaction using a timestamp.  When daylight savings changed, it no longer matches authorize.net time stamp.  My host has verified the settings on the server and it still does not work, so I am forced to fix this within the code.

This is the current code that I am using for the timestamp:
<cfset timestamp=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now())) >

I have found other scripts, but they are even further off.

The timestamp can be checked by going to the following link:
http://developer.authorize.net/tools/responsecode97

Authorize.net says the following:
The transaction fingerprint depends on a timestamp expressed in POSIX Time, sometimes called UNIX Epoch Time. Simply put, it is the number of seconds since January 1, 1970, at Midnight UTC. If you take the current time in the server’s time zone and convert that to UTC, and then use that to calculate POSIX Time, that may introduce the risk of the time being miscalculated when the server switches from Standard Time to Daylight Savings Time. This will cause transaction fingerprints to fail.

To avoid this, we (authorize.net) recommend the following:

-Take care to use whatever options are available in your scripting language of choice to use POSIX time automatically, instead of trying to convert from local time to POSIX time. Most scripting languages support POSIX timestamps.
-Make sure the Web server is using UTC, not local time.
-The operating systems on Web servers should be kept up to date. Since Daylight Savings Time is defined by law and is subject to change, servers may need to be updated to reflect changes.
-Where possible, Web servers should use the Network Time Protocol (NTP) to keep their clocks synchronized.
0
Comment
Question by:lonnyo
  • 2
4 Comments
 
LVL 36

Expert Comment

by:SidFishes
ID: 37771612
0
 
LVL 53

Expert Comment

by:_agx_
ID: 37771876
> no longer matches authorize.net time stamp

I know you said the host check the settings, but without knowing more it does sounds like something on the server is off. How much is it off by? If it's about an hour, the DST settings on your server may be wrong.  For example, one of my test boxes was not set to DST time, so my timestamp was ~3660 seconds/1hr off from theirs

What are your timezone settings?

<cfoutput>
myTime  #now()#<br>
UTC Time #DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now()))#<br>
</cfoutput>

<cfdump var="#getTimeZoneInfo()#">
0
 

Author Comment

by:lonnyo
ID: 37772292
Thanks for the quick responses.  I got pulled onto another project, so I will get back to this later today.  Sorry about that.
0
 
LVL 53

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 37772511
No problem.  I may get caught with stuff this afternoon, but will try and check back later.

Small correction to the debug code above:

<cfoutput>
myTime  #now()#<br>
UTC Time #DateConvert('local2UTC', Now())#<br>
timestamp #DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now()))#<br>
</cfoutput>

<cfdump var="#getTimeZoneInfo()#">
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question