Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
ea03e61f
Commit
ea03e61f
authored
Sep 02, 2020
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
printing all the times when opening index page
parent
654740bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
utils.php
src/php_top/utils.php
+21
-9
No files found.
src/php_top/utils.php
View file @
ea03e61f
...
@@ -43,24 +43,36 @@ function cmd_sensors(){
...
@@ -43,24 +43,36 @@ function cmd_sensors(){
return
wrap_into_xml
(
$res
);
return
wrap_into_xml
(
$res
);
}
}
function
get_formatted_ts
(
$ts
){
$ts_s
=
substr
(
$ts
,
0
,
10
);
$ts_ms
=
substr
(
$ts
,
11
);
$ts_formatted
=
date
(
"Y-m-d H:i:s.
$ts_ms
"
,
$ts_s
);
return
$ts_formatted
;
}
function
cmd_time
(){
function
cmd_time
(){
date_default_timezone_set
(
'UTC'
);
date_default_timezone_set
(
'UTC'
);
exec
(
"date +%s.%3N"
,
$ots
);
$t
=
elphel_get_fpga_time
();
$t
=
elphel_get_fpga_time
();
if
(
!
isset
(
$_GET
[
'ts'
])){
$tsys
=
$ots
[
0
];
//date +%s will report system time
//print(exec("date +%s"));
print
(
"Camera time (fpga):
$t
("
.
get_formatted_ts
(
$t
)
.
")
\n
"
);
print
(
"Camera time:
$t
"
);
print
(
"Camera time (sys):
$tsys
("
.
get_formatted_ts
(
$tsys
)
.
")
\n
"
);
}
else
{
if
(
isset
(
$_GET
[
'ts'
])){
// ts is in ms
// ts is in ms
$ts_s
=
substr
(
$_GET
[
'ts'
],
0
,
10
);
$ts_s
=
substr
(
$_GET
[
'ts'
],
0
,
10
);
$ts_ms
=
substr
(
$_GET
[
'ts'
],
-
3
);
$ts_ms
=
substr
(
$_GET
[
'ts'
],
11
);
//$ts = $_GET['ts']/1000;
$ts_formatted
=
date
(
"Y-m-d H:i:s.
$ts_ms
"
,
$ts_s
);
$ts_formatted
=
get_formatted_ts
(
$_GET
[
'ts'
]
);
print
(
"Your
time:
$ts_s
.
$ts_ms
(
$ts_formatted
)
\n
Camera time:
$t
\n
"
);
print
(
"Your
(browser) time:
$ts_s
.
$ts_ms
(
$ts_formatted
)
\n
"
);
if
(
isset
(
$_GET
[
'apply'
])
||
(
abs
(
$ts_s
-
$t
)
>
24
*
3600
)){
if
(
isset
(
$_GET
[
'apply'
])
||
(
abs
(
$ts_s
-
$t
)
>
24
*
3600
)){
elphel_set_fpga_time
(
$_GET
[
'ts'
]
/
1000
);
elphel_set_fpga_time
(
$_GET
[
'ts'
]
/
1000
);
exec
(
"date -s '
$ts_formatted
'"
);
exec
(
"date -s '
$ts_formatted
'"
);
exec
(
"hwclock --systohc"
);
exec
(
"hwclock --systohc"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment