unix时间,响应总是关闭一分钟(更快/更少)php mysql

gupuwyp2  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(260)

我们有一个时间和出勤门户,其中员工应用程序需要显示倒数计时到他们的轮班开始(例如:员工轮班是9-5,当他们在8:50打开应用程序时,服务器会给出10分钟的响应,应用程序会开始倒计时{9:59,9:58….等等})
我们将所有时间存储在utc中,并使用php函数将其转换为本地时间。
直到上周我们才开始注意到响应总是间隔一分钟(因此对于上面的示例,将显示剩余的9:00分钟,以此类推)。无论轮班时间或轮班开始时间的差异。
以下是服务器端逻辑:

$fields['total_elapsed_time'] = $current_time - strtotime($first_check_in_timestamp);
$fields['current_time'] = $current_time;

以下是应用程序逻辑:

```if currentTime < startTime {

                            self.isUserHaveShiftIn2Hours = true
                            let endDate = Date(timeIntervalSince1970: TimeInterval(startTime))
                            self.totalWorkingSeconds = Double(self.getNumberOfSeconds(startDate: startDate, endDate: endDate))
                            self.startTheCountDownForShift()

                        }```

`let startTime = response.result.value!.shift_start_time`
`let startDate = Date(timeIntervalSince1970: TimeInterval(currentTime))`
`let currentTime = response.result.value!.current_time`

谢谢~

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题