Do I need to worry about timezones in my application? [closed] - date

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I currently have a functional version of my application (web application). My application allows users to schedule appointments online. When submitting appointments do I need to account for time zones? so if someone lived in new york using my applications which are based in California would I need to make adjustments to the time for which the appointments are getting stored as the date time stamps?
I see UTC all over the web without much understanding if time zone still plays a role in all of this. Can someone guide me as to what approach I need to take for my application?
Thank you for your time! Its very much appreciated!

A UTC date is a date/time which is globally the same. Each of the users of your application has a local offset to this date/time, so your application can calculate the correct datetime for each one of your users, based on the UTC date and the offset.
This offset is based on the users location ofcourse, which (depending if you're talking about a web application or desktop or phone app, which you don't mention) might be provided by a browser via JavaScript or through the underlying OS.
So, in short, store all dates as UTC, and calculate the correct date per user to display it in your application.
Most programming languages have functionality for this built-in or available via extensions. Google for "locale" or "Localization" (l10n) in combination with the language or framework you're using to find out how to implement this exactly.
edit: you ask specifically about appointments in your application; if your application runs on a webserver, the webservers datetime settings are used, so this might get you into trouble when you compare a datetime from your user to the current time on your server (to see if an appointment is due, for example)
It will also fail when you want to compare an appointment from two users in different timezones to see if they overlap.
If your application only runs locally, without central storage, it will propably work without resorting to UTC datetimes.

Yes, you need to properly handle the time zones as the calendar should take the system date as it will be different for different user across the globe.

Yes, take timezones into account.
If you can adjust the dates and times to UTC, before you transmit and store them, then you will easily be able to compensate for the strangeness of Daylight Saving times.
If you only adjust the UTC times back for display and input, based on your user's locale, then you can schedule across the world.

Related

Is there any way to get the tamper-proof date and time on iPhone?

For various reasons I need to get from the iPhone the current date and time that can't be meddled with by the user. Yes, I've seen how one can check a server (e.g., here), but that's not invulnerable to tampering if you take a moment to reflect.
There are two knee-jerk reactions I'm expecting to hear:
Use the GPS time.
It can't be done.
In answer to another question, I've described my researches into this matter. To summarize them:
The GPS time shifts with the user-defined settings.
The iPhone definitely has an internal tamper-proof time and date, as shown when date-time reverts after Set Automatically in Settings > General > Time & Date is turned back to on even in a fallout shelter.
What I want to know is how to access this tamper-proof time.
Edit
Just to be clear, the server-based solution is not suitable. For one, it could be faked. For another, the app needs to work without a network connection.
Assuming you always have Internet available, you could implement a class or object that connects to a remote Network Time Protocol server.
Here's an open source GitHub project that should get you started, and the related StackOverflow question I found it at.

Best database for a Statistics System [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I need to build a Statistics System but I don't know if MongoDB would be the best solution. The system needs to track couple of things and than display the information. For example of a similar thing - a site, and every user that first visits the site adds a row with information about him. The system needs to store the data as fast as possible, and, for example, it creats a chart of the growth of users viewing the page using Google Chrome. Also, if a user visits again, a field in the users's already row is updated (say a field called "Days").
The system needs to handle 200,000 new visits a day (new records), 20,000,000 users visits again (updates) a day, and 800,000,000 DB records. It needs also to output the data fast - for example, creating a chart of how much users visits each day from England, using Google Chrome, etc.
So what would be the best DB to handle this data? Would MongoDB handle this fine?
Thanks!
Mongodb allows atomic updates and scales very well. That's exactly what it's designed for. But keep in mind two things: beware the disk space, it may run out very quickly and if you need quick stats (like region coverage, traffic sources, etc.), you have to precompute them. The fastest way is to build a simple daemon for this that would keep all numbers in memory and save it hourly/daily.
Redis is a very good choice for it, provided you have a lot of RAM, or a strategy to shard the data over multiple nodes. it's good because:
it is in memory, so you can do real time analytics (I think bit.ly's real time stats use it). in fact, it was originally created for that.
it is very very fast, can do hundreds of thousands of updates a seconds with ease.
it has atomic operations.
it has sorted sets which are great for time series.
RDM Workgroup is a database management system for desktop and server environments and allows in-memory speed as well.
You can also use its persistence feature; where you manage data in-memory and then transfer that data on-disk when the application shuts down so there is no data loss.
It is based on the network model with an intuitive interface so its scalability is top-notch and will be able to handle the large load of new visitors that you will be expecting.

Unix timestamp question, different times

I am working with Unix timestamps, but I get a different time on my Android phone and my computer than the time given on http://www.unixtimestamp.com/index.php
The time difference is one hour (give or take a few seconds probably, didn't ever design an extremely accurate test).
I thought that the Unix time was the same everywhere on earth (or perhaps the universe, but that brings up questions of frames of reference and velocities that I don't even want to think about).
Basically my question is, what is going on here? I get the time on the Android device using Date date = new Date(); long now = date.getTime(); (I account for this having milliseconds btw) and I connect through putty to a linux server and the time is the same (obtained by date +%s). It's just the website that disagrees on the time, and since I don't know too too much about Unix timestamps and the site looks legit I wonder how this happened.
ps. I live in Saskatchewan, which doesn't observe daylight savings, but I don't see how that would really factor in. Does the website read the time from my computer maybe?
pps. sorry for rambling
That web site displays the wrong time.

Is it possible to get a users timezone for an application hosted by Citrix XenApp?

I have a VB6 application hosted to users around the world through Citrix XenApp. I'm using the windows GetTimeZoneInformation call to find the time zone of the user in order to adjust some dates shown in the app (the dates come to the app in GMT). Unfortunately it looks like GetTimeZoneInformation gets the timezone of the Citrix server rather than the user running the application. Is there a Citrix based solution for this or am I going to need to change my implementation? This seems like a pretty big hole for Citrix hosted apps as I imagine you'd have the same problem with other localization settings.
What you ask should happen automatically: that applications do not get the server's but the client's time zone when asking Windows for the time zone. Here is a good description of how this works (PortICA, by the way, was a kind of early code name for XenDesktop).
If it does not work: client time zone support can be disabled, or any number of other things may have gone wrong. Check Citrix KB article CTX303498 for possible solutions.

almost live forex currency rates [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I need to get live forex exchange rates for my personal application. I know that there's no free service that has this data available for download. I've been using Yahoo Finance, but I've just found out that it has a delay of 15 minutes or so. Is there any way I could get fresher rates somewhere? Say, 5-minute old instead of 15?
Many forex brokers offer free "informers" that autoload data in an interval of seconds, so maybe there's a few that allow this data to be downloaded in bigger intervals without the use of their informers strictly for personal use?
TrueFX has free real-time (multiple updates per second) forex quotes, but only for a limited number of pairs: http://webrates.truefx.com/rates/connect.html?f=html
They also have free downloadable tick data for the same pairs, going back to May 2009: http://truefx.com/?page=downloads
You can get real-time quotes for a larger selection of pairs from FXCM: http://rates.fxcm.com/RatesXML
Realtime rates for about 40 currency pairs are available here: http://1forge.com/forex-data-api, eg: https://1forge.com/forex-quotes/quotes
They also have free downloadable tick-data, going back to 2007, but you need to create a demo account and use a COM based Windows API called Order2Go to retrieve it.
They promised that they will make available the same tick data in CSV format for free sometime this year here: http://www.forexcodesource.com/index.php/Category:Historical_Data
Here are a bunch of equity/fx data providers, however they are not free.
http://finviz.com/store/market-data-providers.ashx
If you're trying to keep everything free, then you'll probably have to hack something together.
For example, in MT4 there is a DDE hook that you can use to broadcast the quotes. You'll need a windows box(or vm) running MT4 and an app listening to the DDE server, that would forward the quotes off to your linux server via a TCP socket, or even HTTP. The lag should be less than a second if done right.
Here's the .net library I use to receive the DDE quotes.
http://www.4xlab.net/cs/forums/136/ShowPost.aspx
Also, if you are looking for historical tick data, then this is a great source.
http://ratedata.gaincapital.com/
download metatrader from any broker, and write an expert adviser to log all the data you want to a file. have another process that read the file. if you really want to get fancy, you can call c functions from mt4 code. its not that hard to write some c code to store data to a db instead of logging it to a file.