Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5a0e92b42e0d
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d70008816ce8
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Sep 3, 2020

  1. Copy the full SHA
    d700088 View commit details
Showing with 12 additions and 3 deletions.
  1. +12 −3 scopehal/LeCroyOscilloscope.cpp
15 changes: 12 additions & 3 deletions scopehal/LeCroyOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -1564,17 +1564,26 @@ map<int, DigitalWaveform*> LeCroyOscilloscope::ProcessDigitalWaveform(string& da
if(1 != sscanf(tmp.c_str(), "%ld", &timestamp))
return ret;

//Convert Jan 1 2000 in the client's local time zone (assuming this is the same as instrument time) to Unix time
//Get the client's local time.
//All we need from this is to know whether DST is active
tm now;
time_t tnow;
time(&tnow);
localtime_r(&tnow, &now);

//Convert Jan 1 2000 in the client's local time zone (assuming this is the same as instrument time) to Unix time.
//Note that the instrument time zone conversion seems to be broken and not handle DST offsets right.
//Move the epoch by an hour if we're currently in DST to compensate.
tm epoch;
epoch.tm_sec = 0;
epoch.tm_min = 0;
epoch.tm_hour = 0;
epoch.tm_mday = 1;
epoch.tm_mon = 0;
epoch.tm_year = 100;
epoch.tm_wday = 6; //Jan 1 2000 was a Saturday
epoch.tm_wday = 6; //Jan 1 2000 was a Saturday
epoch.tm_yday = 0;
epoch.tm_isdst = 0;
epoch.tm_isdst = now.tm_isdst;
time_t epoch_stamp = mktime(&epoch);

//Pull out nanoseconds from the timestamp and convert to picoseconds since that's the scopehal fine time unit