ZKLibrary
ZKLibrary copied to clipboard
How to sync PC current time to device
Dear Sir Kamshory, please guide me in to sync PC current time to device. i'm not much familiar to development but i can re-code basic applications.
To synchronize attendance data between the device and PC, you need to create a database on a PC. Because the device cannot do push data, the PC must pull data periodically. After the attendance data has been successfully entered into the database, delete attendance data on the device. Don't forget to disable the device during this process to ensure that no attendance data is deleted because the user checks the device during this process. You also have to feed user data to the database according to the data on the device.
dear, my means to sync date and time from pc not data from pc
$zk->setTime("2019-07-30 23:54:51");
+923422251896 this is my whatsapp# i just need your few minutes because tomorrow is end of my given deadline to submit the project.
What is code on file zkconst.php?
function encode_time($t) { /*Encode a timestamp send at the timeclock
copied from zkemsdk.c - EncodeTime*/
$d = ( ($t->year % 100) * 12 * 31 + (($t->month - 1) * 31) + $t->day - 1) *
(24 * 60 * 60) + ($t->hour * 60 + $t->minute) * 60 + $t->second;
return $d;
}
function decode_time($t) {
/*Decode a timestamp retrieved from the timeclock
copied from zkemsdk.c - DecodeTime*/
$second = $t % 60;
$t = $t / 60;
$minute = $t % 60;
$t = $t / 60;
$hour = $t % 24;
$t = $t / 24;
$day = $t % 31+1;
$t = $t / 31;
$month = $t % 12+1;
$t = $t / 12;
$year = floor( $t + 2000 );
$d = date("Y-m-d H:i:s", strtotime( $year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.':'.$second) );
return $d;
}
Can I see your own code when you call $zk->setTime()?
Wait... What library do you used? My library is https://github.com/kamshory/ZKLibrary/blob/master/zklibrary.php
<?php
include "zklibrary.php";
$zk = new ZKLibrary('192.168.1.102', 4370);
$zk->connect();
$zk->disableDevice();
$zk->setTime(date("Y-m-d H:i:s"));
$zk->testVoice();
$zk->enableDevice();
$zk->disconnect();
?>
https://github.com/kamshory/ZKLibrary/blob/master/README.md
thank you so much dear, but accidentally i'm using another zklibrary which is in parts.
No. That is not mine.
Make sure you only use https://github.com/kamshory/ZKLibrary/blob/master/zklibrary.php
yes dear its not your library. it is from vodvud and it is a very faster to load. thanks for your help. although it is very helpful for me.
@Meemkhaan I already figure out how it works. I also add the default timezone and set the time.
date_default_timezone_set('Asia/Manila'); //Your Default Timezone
$zk->setTime(date('Y-m-d H:i:s'));
https://github.com/vodvud/php_zklib/issues/16