Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
fea0a991
Commit
fea0a991
authored
Apr 09, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 TimeGridAdvHelperExt 的 GetAD AD数据时间不对
parent
11ba095b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
36 deletions
+21
-36
TimeGridAdvHelper.cs
Project.FLY.FlyADBase/FlyADBase/TimeGridAdvHelper.cs
+21
-36
No files found.
Project.FLY.FlyADBase/FlyADBase/TimeGridAdvHelper.cs
View file @
fea0a991
...
...
@@ -517,38 +517,28 @@ namespace FlyADBase
DateTime
lastTime
=
reponse2
.
Last
().
dt
;
reponse_endTime
=
lastTime
;
return
GetAD
(
reponse2
,
begin
);
return
GetAD
(
reponse2
);
}
public
static
List
<
int
>
GetAD
(
List
<
DateTimeUnit3
>
adPool
)
{
//通过adPool[0].dt 与 adPool[1].dt 的时间差,计算adPool[0].dt的开始时间
//如果没有adPool[1].dt,就当 adPool[0].dt 的开始时间为 adPool[0].dt - adPool[0].datas.Count() * ad_ts_ms;
DateTime
begin
;
if
(
adPool
.
Count
()
>=
2
)
{
begin
=
adPool
[
0
].
dt
-
(
adPool
[
1
].
dt
-
adPool
[
0
].
dt
);
}
else
{
double
t_ms
=
adPool
.
First
().
datas
.
Count
()
*
ad_ts_ms
;
begin
=
adPool
.
First
().
dt
-
TimeSpan
.
FromTicks
((
long
)(
t_ms
*
TimeSpan
.
TicksPerMillisecond
));
}
return
GetAD
(
adPool
,
begin
);
return
GetAD
(
adPool
,
DateTime
.
MinValue
);
}
public
static
List
<
int
>
GetAD
(
List
<
DateTimeUnit3
>
adPool
,
DateTime
begin
)
{
List
<
int
>
reponse
=
new
List
<
int
>();
DateTime
lastTime
=
adPool
.
Last
().
dt
;
//导出数据的时间
DateTime
idealTime
=
adPool
.
Last
().
dt
;
//每个ad包的每个数据不是准确的1.28ms,肯定比1.28ms大,每次需要准确计算
//每个ad包的每个数据不是准确的1.28ms,肯定比1.28ms大,每次需要准
for
(
int
i
=
0
;
i
<
adPool
.
Count
();
i
++)
{
int
idx
=
adPool
.
Count
()
-
1
-
i
;
double
curr_ad_ts_ms
;
//当前缓存区包,数据的时间间隔
TimeSpan
curr_ad_ts
;
//计算这个包每个数据的时间间隔
DateTime
end_dt
=
adPool
[
idx
].
dt
;
...
...
@@ -556,38 +546,37 @@ namespace FlyADBase
{
var
begin_dt
=
adPool
[
idx
-
1
].
dt
;
double
total_ms
=
(
end_dt
-
begin_dt
).
Ticks
/
TimeSpan
.
TicksPerMillisecond
;
curr_ad_ts_ms
=
total_ms
/
adPool
[
idx
].
datas
.
Count
();
var
curr_ad_ts_ms
=
total_ms
/
adPool
[
idx
].
datas
.
Count
();
curr_ad_ts
=
TimeSpan
.
FromTicks
((
long
)(
curr_ad_ts_ms
*
TimeSpan
.
TicksPerMillisecond
));
}
else
if
(
adPool
.
Count
()
>
1
)
{
var
begin_dt
=
adPool
[
idx
].
dt
-
(
adPool
[
idx
+
1
].
dt
-
adPool
[
idx
].
dt
);
double
total_ms
=
(
end_dt
-
begin_dt
).
Ticks
/
TimeSpan
.
TicksPerMillisecond
;
curr_ad_ts_ms
=
total_ms
/
adPool
[
idx
].
datas
.
Count
();
var
curr_ad_ts_ms
=
total_ms
/
adPool
[
idx
].
datas
.
Count
();
curr_ad_ts
=
TimeSpan
.
FromTicks
((
long
)(
curr_ad_ts_ms
*
TimeSpan
.
TicksPerMillisecond
));
}
else
{
curr_ad_ts
_ms
=
ad_ts_m
s
;
curr_ad_ts
=
ad_t
s
;
}
DateTime
actTime
=
adPool
[
idx
].
dt
;
//从缓存区获取数据的时间
double
act_ms
=
0
;
double
ideal_ms
=
0
;
//插值,让输出可以有准确的间隔为 ad_ts_ms
for
(
int
j
=
0
;
j
<
adPool
[
idx
].
datas
.
Count
();
j
++)
{
int
idx2
=
adPool
[
idx
].
datas
.
Count
()
-
1
-
j
;
int
ad
=
adPool
[
idx
].
datas
[
idx2
];
actTime
-=
curr_ad_ts
;
act_ms
+=
curr_ad_ts_ms
;
while
(
ideal_ms
<
act_ms
)
while
(
idealTime
>
actTime
)
{
reponse
.
Add
(
ad
);
ideal_ms
+=
ad_ts_ms
;
lastTime
-=
ad_ts
;
reponse
.
Add
(
ad
);
//导出数据
idealTime
-=
ad_ts
;
//导出数据时间累加
}
if
(
lastTime
<
begin
)
goto
_end
;
//完成
}
if
(
idealTime
<
begin
)
goto
_end
;
//完成
}
_end
:
//反转
...
...
@@ -596,10 +585,6 @@ namespace FlyADBase
}
/// <summary>
/// 获取 时间在 begin~end 的 AD数据包
/// </summary>
...
...
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