Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
08b88714
Commit
08b88714
authored
Aug 24, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/raop: use fill_int() in fill_time_...()
Eliminate duplicate code.
parent
bcaff4b8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
19 deletions
+14
-19
raop_output_plugin.c
src/output/raop_output_plugin.c
+14
-19
No files found.
src/output/raop_output_plugin.c
View file @
08b88714
...
...
@@ -375,13 +375,24 @@ get_tcp_connect_by_host(int sd, const char *host, short destport,
}
/*
* Calculate the current NTP time, store it in the buffer.
*/
static
void
fill_int
(
unsigned
char
*
buffer
,
unsigned
int
rtp_time
)
{
int
iter
;
for
(
iter
=
0
;
iter
<
4
;
iter
++
)
{
buffer
[
iter
]
=
(
rtp_time
>>
((
3
-
iter
)
*
8
))
&
0xff
;
}
}
/*
* Store time in the NTP format in the buffer
*/
static
void
fill_time_buffer_with_time
(
unsigned
char
*
buffer
,
struct
timeval
*
tout
)
{
unsigned
long
secs_to_baseline
=
964697997
;
int
iter
;
double
fraction
;
unsigned
long
long_fraction
;
unsigned
long
secs
;
...
...
@@ -389,12 +400,8 @@ fill_time_buffer_with_time(unsigned char *buffer, struct timeval *tout)
fraction
=
((
double
)
tout
->
tv_usec
)
/
1000000
.
0
;
long_fraction
=
(
unsigned
long
)
(
fraction
*
256
.
0
*
256
.
0
*
256
.
0
*
256
.
0
);
secs
=
secs_to_baseline
+
tout
->
tv_sec
;
for
(
iter
=
0
;
iter
<
4
;
iter
++
)
{
buffer
[
iter
]
=
(
secs
>>
((
3
-
iter
)
*
8
))
&
0xff
;
}
for
(
iter
=
0
;
iter
<
4
;
iter
++
)
{
buffer
[
4
+
iter
]
=
(
long_fraction
>>
((
3
-
iter
)
*
8
))
&
0xff
;
}
fill_int
(
buffer
,
secs
);
fill_int
(
buffer
+
4
,
long_fraction
);
}
/*
...
...
@@ -410,18 +417,6 @@ fill_time_buffer(unsigned char *buffer)
}
/*
* Calculate the current NTP time, store it in the buffer.
*/
static
void
fill_int
(
unsigned
char
*
buffer
,
unsigned
int
rtp_time
)
{
int
iter
;
for
(
iter
=
0
;
iter
<
4
;
iter
++
)
{
buffer
[
iter
]
=
(
rtp_time
>>
((
3
-
iter
)
*
8
))
&
0xff
;
}
}
/*
* Recv the NTP datagram from the AirTunes, send back an NTP response.
*/
static
bool
...
...
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