Comments (23)
Confirming, This fixed my issue
On Fri, Aug 12, 2016 at 11:53 AM, hjelmua [email protected] wrote:
For me changing the lines in leftmain worked fine.
// $tz_stamp = mktime ($hour, $min, $sec, $month, $day, $year);
// testing better ways
$tz_stamp = time ($hour, $min, $sec, $month, $day, $year);—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AOwSwLFKd_Qa6FJ49Cj-Am7kmAwTDg_gks5qfMFHgaJpZM4G8bh4
.
from timeclock.
What is your php.ini date.timezone
option currently set as?
What about the config.inc.php
options $use_client_tz
and $use_server_tz
?
I have both config.inc.php
options set to no
, and my timezone is set in php.ini correctly. I don't have any issues with this. FYI php defaults to GMT when date.timezone
is unset or left as default.
from timeclock.
Also I'll commit an addition to config.inc.php
which will allow the system to override the php.ini timezone in case you can't modify it.
from timeclock.
Take a look at this commit and see if it fixes your issue 4e76ac5 if it does then fix date.timezone
in your php.ini :)
from timeclock.
Sorry I just saw this. In php.ini, that was one of the first things I set:
date.timezone="America/Los_Angeles"�
I'll incorporate your changes into my fork and see if that solves my issues and report back :-)
from timeclock.
While you're at it could you add an echo statement to the report your running:
echo date_default_timezone_get();
and see if the timezone matches what you've selected. Oh and what do you have selected in config.inc.php
?
from timeclock.
https://drive.google.com/file/d/0B8rpAE3Gj5gZUThJNG94aWc4dkE/view?usp=sharing
At the top left I have added a line in the header echoing the timezone for the reports.
The timezone being used/picked up by the script is the same as in php.ini. Notice that the time the report was run is in PST, but all the user punches are in GMT.
from timeclock.
Can you send a screenshot of the info
database table?
Mine seems to be working correctly with punches stored in the database as GMT unix timestamps (I have both config.inc.php
timezone options set to 'no'):
from timeclock.
Sure, can do. I set use server timezone to yes (server is in my same time zone... it's only a few miles from me), and check this out:
https://github.com/andrew867/timeclock/blob/master/functions.php#L304
Is not being set. $tzo is blank.
Check out this screenie: https://drive.google.com/file/d/0B8rpAE3Gj5gZeXJEME9VWjVfNWM/view?usp=sharing
Edit: Maybe I'm barking up the wrong tree here :-/
This is the code I'm using in header post reports:
<?php
include "header.reports.inc.php";
echo 'Timezone: ' . date_default_timezone_get();
echo "<link rel='stylesheet' type='text/css' media='screen' href='../css/default.css' />\n";
echo "<link rel='stylesheet' type='text/css' media='print' href='../css/print.css' />\n";
echo "<script language=\"javascript\" src=\"../scripts/CalendarPopup.js\"></script>\n";
echo "<script language=\"javascript\">document.write(getCalendarStyles());</script>\n";
echo "<script language=\"javascript\">var cal = new CalendarPopup('mydiv');</script>\n";
echo "<script language=\"javascript\" src=\"../scripts/pnguin.js\"></script>\n";
include '../scripts/dropdown_post_reports.php';
echo "</head>\n";
setTimeZone();
echo '<br />Use Server Timezone: ' .$use_server_tz . '
<br />Current offset is: ' . $tzo . '<br /><br />';
echo "<body onload='office_names();'>\n";
?>
from timeclock.
Here is a screenshot of the info table:
https://drive.google.com/file/d/0B8rpAE3Gj5gZVWk5d2Y5RkotV2M/view?usp=sharing
from timeclock.
I remember having a lot of trouble in the past getting timezones working properly in timeclock. Here's a quick description of what happens:
- If
$use_server_tz
is set then timeclock queries the server for the current timezone and then sets$tzo
to a specific number of seconds offset (fromdate('Z')
) that the server thinks it has from GMT. - Most functions in timeclock use something like
date('Y-M-d', time() + $tzo)
, therefore in PHP 5.1+ when your timezone is set in php.ini, thedate()
/time()
functions automatically compensate for the timezone difference then timeclock adds another offset back onto the previously compensated timestamp. - That is why
$use_server_tz
should be set to 'no' to set$tzo
to 0 and allow PHP to adjust the time offset usingphp.ini
or thedate_default_timezone_set()
function. - I never had a need to use
$use_client_tz
so it was never fixed. What should be done is a DB column added to the user and set each user's home timezone independently of the server. You could then use thedate_default_timezone_set()
with the returned user timezone. Relying on Javascript to set a timezone and cookie is just asking for trouble. This is good for a company who has users in different areas. - Adding onto the new DB column fix, you could also add an option to enable a 'select current timezone' dropdown on the punch in/out page that would override the user selected and server timezone. This is good for users who are on the road.
Specific to your issue PHP might be compensating automatically then something related to $use_server_tz
is screwing the compensation back up. When you make some more test punches could you set the note to the current correct local time that the punch is put into the system?
from timeclock.
But when I set it to no, the same thing happens. $tzo = 0 in both cases, yes and no on use server timezone.
from timeclock.
Ok, so this is fun stuff. It's working now, but I didn't change anything except use server timezone to 0.
When I started having this trouble this morning, both client and server timezone settings were 0.
The reports are still not using the offsets except for only the new punches. Apparently instead of performing the offset at time of display, it is performing the offset before writing to the database. I don't need to point out how fail this is. This means that any time you change your timezone, you completely screwed over your timeclock.
Times should be written to the db as GMT and then the offset applied whenever written in a report or displayed.
from timeclock.
I agree, it's a pretty big bug. What should happen is the punch should be stored in GMT with another column specifying what timezone it was punched from (to keep it complete with the other changes I mentioned above). Also the info
table needs a unique column (probably should be renamed to punches
), it's currently a PITA when using phpMyAdmin.
from timeclock.
Excellent point about the Timezone column and yes, I completely agree. I'm glad I understand what is actually going on now though. I really appreciate you time spent in helping me! :-D
from timeclock.
I've opened #18, #19, and #20 outlining the issues we just found and potential fixes. Feel free to assign them to yourself if you feel like fixing them. I had originally taken over timeclock as I was developing an Arduino based NFC timeclock to use at work to track my overtime, I should dig out my old code and publish it as it seems like you might be able to make use of it!
from timeclock.
I'll see what I can do, no promises. Unfortunately it's kind of becoming clear that I won't really be able to use this for work, which puts it in the hobby column. I'll see if I can't make some improvements to it though. It has potential, just needs a few extra kicks to get it headed in the right direction.
from timeclock.
Have a look at TimeTrex for your work, it's what I ended up using and seemed to work quite well.
from timeclock.
Where are you at currently with working on the time issues? Is there any insight you can provide on the issue other than what has been discussed already? I too was looking at this for work. When I noticed the time issues, I realized we couldn't use it. My company likes open source stuff so I have a time limit of 1 week to have this working or I have to move on.
from timeclock.
I finally settled on timeclockwizard.com It's extremely nice and completely web based. I didn't really like the idea behind timetrex. It looks nice, but it also looks like a pain to set up.
from timeclock.
For me changing the lines in leftmain worked fine.
// $tz_stamp = mktime ($hour, $min, $sec, $month, $day, $year);
// testing better ways
$tz_stamp = time ($hour, $min, $sec, $month, $day, $year);
from timeclock.
In functions.php, setTimeZone(), I added a new line 'global $tzo;'
That did the trick for me.
from timeclock.
thanks for the fix, will give it a try
On Sep 20, 2016 3:01 PM, "John" [email protected] wrote:
In functions.php, setTimeZone(), I added a new line 'global $tzo;'
That did the trick for me.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AOwSwAmzqromwQHL_8eRnKdwpJkffcynks5qsFeogaJpZM4G8bh4
.
from timeclock.
Related Issues (20)
- Problem with create_tables.sql HOT 1
- Can't detele time HOT 3
- Changing the first day of the week HOT 1
- "Computes overtime hours." HOT 1
- PHP7 Support? HOT 9
- duplicate punches are allowed
- Notice: Undefined variable: db_prefix in C:\xampp\htdocs\time\phpweather.php on line 107 HOT 1
- erros that pop up when using the punchclock HOT 1
- Php error HOT 2
- Installation on Hosted account HOT 1
- Replacement for discontinued NOAA metar site
- some errors
- Admin Login HOT 3
- edit settings in timeclock HOT 5
- Puncs card and time clock as SaaS HOT 2
- Calendar error HOT 1
- Which of the Forks is the Successor? HOT 8
- Unable to create groups
- Daylight saving time
- Problem with reserved word Group in mysql
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timeclock.