GetDeviceTime

Definition

Usage

Obtain the device time.

Parameter

Device number

Long pointers pointing to variables. The values are the date and time of the device.

Return Value

Return True if it is successful, or return False.

Related Function

SetDeviceTime, SetDeviceTime2

 

Ejemplo

C#

                                    //Create Standalone SDK class dynamicly.
                            zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
                                    int iMachineNumber = 1;
                            axCZKEM1.Connect_Net("10.0.0.43", 4370);
                                    int idwErrorCode = 0;
                                    int idwYear = 0;
                                    int idwMonth = 0;
                                    int idwDay = 0;
                                    int idwHour = 0;
                                    int idwMinute = 0;
                                    int idwSecond = 0;
                                    if (axCZKEM1.GetDeviceTime(iMachineNumber, ref idwYear, ref idwMonth, ref idwDay, ref idwHour, ref idwMinute, ref idwSecond))
                            {
                                MessageBox.Show("The Device Time is: " + idwYear.ToString() + "-" + idwMonth.ToString() + "-" + idwDay.ToString() + " " + idwHour.ToString() + ":" + idwMinute.ToString() + ":" + idwSecond.ToString());
                            }
                                    else
                            {
                                axCZKEM1.GetLastError(ref idwErrorCode);
                                MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
                            }
                        

VB

                            'Create Standalone SDK class dynamicly.
                            Dim axCZKEM1 As New zkemkeeper.CZKEM
                            Dim bIsConnected = False 'the boolean value identifies whether the device is connected
                            Dim sIP As String = "10.0.0.43"
                            Dim sPort As Integer = 4370
                            Dim idwErrorCode As Integer = 0
                            Dim iMachineNumber As Integer = 1
                            bIsConnected = axCZKEM1.Connect_Net(sIP, Convert.ToInt32(sPort))
                            Dim idwYear As Integer
                            Dim idwMonth As Integer
                            Dim idwDay As Integer
                            Dim idwHour As Integer
                            Dim idwMinute As Integer
                            Dim idwSecond As Integer
                            If axCZKEM1.GetDeviceTime(iMachineNumber, idwYear, idwMonth, idwDay, idwHour, idwMinute, idwSecond) Then 'show the time
                            MsgBox("The Device TIme is=" & idwYear.ToString() + "-" + idwMonth.ToString() + "-" + idwDay.ToString() + " " + idwHour.ToString() + ":" + idwMinute.ToString() + ":" + idwSecond.ToString(), MsgBoxStyle.Information, "Success")
                            Else
                            axCZKEM1.GetLastError(idwErrorCode)
                            MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
                            End If