Poco::Net::NTPPacket
Expected behavior
_originateTimestamp initialized with the correct value
Actual behavior
_originateTimestamp is initialized substracting 70 years (2874597888) from the wrong value utcTime() that is (from documentation) UTC base time is midnight, October 15, 1582. Resolution is 100 nanoseconds
POCO version
all
Looks like it should be using epochTime(), but I have no time to investigate right now. @micheleselea can you change it and write some additional tests?
I'm going to dig about it. For what I understand from RFC https://www.ietf.org/rfc/rfc5905.txt it's possible using that 1852 timestamp using a fixed offset of 2,874,597,888 that is something familiar looking at the code, but the timestamp decoded in wireshark is wrong. I'll check it
looking at the RFC I think the way we should initialize _originateTimestamp is using the get_time() below. I did some tests and wireshark decodes good.
#define JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
#define FRAC 4294967296. /* 2^32 as a double */
#define U2LFP(a) (((unsigned long long) \
((a).tv_sec + JAN_1970) << 32) + \
(unsigned long long) \
((a).tv_usec / 1e6 * FRAC))
Poco::UInt64 get_time()
{
struct timeval unix_time;
Poco::Timestamp ts;
unix_time.tv_sec = ts.epochTime();
unix_time.tv_usec = ts.epochMicroseconds() % Poco::Timestamp::resolution();
return (U2LFP(unix_time));
}
I implemented an NTP server but need some changes to NTPPacket structure to let you create the paket from scratch. If you want I can submit some code
sure, send a pull
Ok but I have the other pull request pending. I cannot fork another project until the other is merged isn't it?
I reviewed, please fix it and I'll merge
I don't know why but I can't sync with github application the the forked repositories since last week, It tells me that there's a module that can't download

probably related to #2290 , @zosrothko has re-created tags since, but you may have an old fork of the repo, containing submodule commits that were wiped out - you may have to fork a fresh version
I have re-forked just 1 hour ago and the errors comes out after new re-forked
Could be something you have locally, I just tried to fork directly from github page, no problem
yes from github I can fork without problem. My problem is when with GitHub software I make the download for changing files and make commits. Anyway I just double check my github istallation
I try different forks, different git client (tortoise git gitgui, github software) but I have always the same problem of submodule...do no understand how to solve
Log from last try:
Cloning into 'openssl'... fatal: reference is not a tree: 26b1673caad94a702b6d694f48f917a283b30777 Unable to checkout '26b1673caad94a702b6d694f48f917a283b30777' in submodule path 'openssl'
@micheleselea do not recurse submodules:
git clone https://github.com/pocoproject/poco
then (only if you need openssl on windows):
cd poco
git clone https://github.com/pocoproject/openssl
@zosrothko do you know which tag is still causing this broken reference? I can reproduce the problem with --recurse-submodules
I'm going to try
yes, that was the problem, I'm going to patch NTPClient
This issue is stale because it has been open for 365 days with no activity.
@micheleselea what is the status of this? apparently it was never fixed
I did it in my own code using _originateTimestamp = get_time(); but I implemented years ago for a NTP server, I think in PocoLib there's only ntp client, anyway was a long time ago...