Skip to content

Commit ccb1960

Browse files
committed
Fix compile on windows issues from upgrade to std::chrono; bump app version to 1.0.11
1 parent fd72fb2 commit ccb1960

File tree

7 files changed

+25
-19
lines changed

7 files changed

+25
-19
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.1...3.20 FATAL_ERROR)
22

3-
project(InterSpec VERSION 1.0.10)
3+
project(InterSpec VERSION 1.0.11)
44

55
set(CMAKE_CXX_STANDARD 14)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)

src/DrfSelect.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,24 @@
7575
#include "rapidxml/rapidxml.hpp"
7676
#include "rapidxml/rapidxml_print.hpp"
7777

78-
#include "SpecUtils/SpecFile.h"
78+
7979
#include "SpecUtils/DateTime.h"
80-
#include "InterSpec/DrfSelect.h"
81-
#include "InterSpec/InterSpec.h"
82-
#include "InterSpec/AuxWindow.h"
80+
#include "SpecUtils/SpecFile.h"
8381
#include "SpecUtils/Filesystem.h"
8482
#include "SpecUtils/ParseUtils.h"
8583
#include "SpecUtils/StringAlgo.h"
84+
#include "SpecUtils/SpecUtilsAsync.h"
85+
86+
#include "InterSpec/DrfSelect.h"
87+
#include "InterSpec/InterSpec.h"
88+
#include "InterSpec/AuxWindow.h"
8689
#include "InterSpec/ColorTheme.h"
8790
#include "InterSpec/HelpSystem.h"
8891
#include "InterSpec/SimpleDialog.h"
8992
#include "InterSpec/InterSpecApp.h"
9093
#include "InterSpec/PhysicalUnits.h"
9194
#include "InterSpec/DataBaseUtils.h"
9295
#include "InterSpec/WarningWidget.h"
93-
#include "SpecUtils/SpecUtilsAsync.h"
9496
#include "InterSpec/SpecMeasManager.h"
9597
#include "InterSpec/SpectraFileModel.h"
9698
#include "InterSpec/RowStretchTreeView.h"
@@ -171,7 +173,7 @@ namespace
171173
string valstr;
172174
if( val > 0 )
173175
{
174-
SpecUtils::time_point_t ptt = std::chrono::system_clock::from_time_t( time_t(val) );
176+
SpecUtils::time_point_t ptt = chrono::time_point_cast<chrono::microseconds>( chrono::system_clock::from_time_t( time_t(val) ) );
175177
ptt += std::chrono::seconds( 60*m_timeZoneOffset );
176178
valstr = SpecUtils::to_common_string(ptt, true);
177179
}
@@ -1051,7 +1053,7 @@ void RelEffFile::handleSaveFileForLater()
10511053
filename = filename.substr( 0, filename.size() - orig_extension.size() );
10521054

10531055
const int offset = wApp->environment().timeZoneOffset();
1054-
auto now = std::chrono::system_clock::now();
1056+
auto now = chrono::time_point_cast<chrono::microseconds>( chrono::system_clock::now() );
10551057
now += std::chrono::seconds(60*offset);
10561058
string timestr = SpecUtils::to_vax_string(now); //"2014-Sep-19 14:12:01.62"
10571059
const string::size_type pos = timestr.find( ' ' );
@@ -3168,7 +3170,7 @@ void DrfSelect::handleUserChangedUploadedDrfName()
31683170
if( value.empty() )
31693171
{
31703172
const int offset = wApp->environment().timeZoneOffset();
3171-
auto now = std::chrono::system_clock::now();
3173+
auto now = chrono::time_point_cast<chrono::microseconds>( chrono::system_clock::now() );
31723174
now += std::chrono::seconds(60*offset);
31733175
value = SpecUtils::to_vax_string(now);
31743176
m_uploadedDetName->setText( WString::fromUTF8(value) );
@@ -3698,8 +3700,8 @@ void DrfSelect::fileUploadedCallback( const UploadCallbackReason context )
36983700
if( userDrfFilename.size() < 15 )
36993701
{
37003702
const int offset = wApp->environment().timeZoneOffset();
3701-
auto now = std::chrono::system_clock::now();
3702-
now += std::chrono::seconds(60*offset);
3703+
auto now = chrono::time_point_cast<chrono::microseconds>( chrono::system_clock::now() );
3704+
now += chrono::seconds(60*offset);
37033705
userDrfFilename += " " + SpecUtils::to_vax_string(now);
37043706
}
37053707

src/InterSpec.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,7 +4095,7 @@ void InterSpec::logMessage( const Wt::WString& message, int priority )
40954095
// wApp->triggerUpdate();
40964096
}else
40974097
{
4098-
auto now = std::chrono::system_clock::now();
4098+
auto now = chrono::time_point_cast<chrono::microseconds>( chrono::system_clock::now() );
40994099
cerr << "Message " << SpecUtils::to_iso_string( now ) << " ";
41004100
cerr << "[" << priority << "]: ";
41014101
cerr << message.toUTF8() << endl << endl;
@@ -6972,8 +6972,8 @@ void InterSpec::saveChartToImg( const bool spectrum, const bool asPng )
69726972
filename += "_timechart";
69736973

69746974
const int offset = wApp->environment().timeZoneOffset();
6975-
auto localtime = std::chrono::system_clock::now();
6976-
localtime += std::chrono::seconds(60*offset);
6975+
auto localtime = chrono::time_point_cast<chrono::microseconds>( chrono::system_clock::now() );
6976+
localtime += chrono::seconds(60*offset);
69776977

69786978
std::string timestr = SpecUtils::to_iso_string( localtime );
69796979
auto ppos = timestr.find('.');

src/InterSpecApp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ void InterSpecApp::prepareForEndOfSession()
11451145
const int offset = environment().timeZoneOffset();
11461146
WString desc = "End of Session";
11471147
const auto now = chrono::system_clock::now() + chrono::seconds( 60*offset );
1148-
WString name = SpecUtils::to_common_string( now, true ); //"9-Sep-2014 15:02:15"
1148+
WString name = SpecUtils::to_common_string( chrono::time_point_cast<chrono::microseconds>(now), true ); //"9-Sep-2014 15:02:15"
11491149

11501150
Wt::Dbo::ptr<UserState> dbstate;
11511151
std::shared_ptr<DataBaseUtils::DbSession> sql = m_viewer->sql();

src/MakeDrf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3077,7 +3077,7 @@ void MakeDrf::writeCsvSummary( std::ostream &out,
30773077
int offset = 0;
30783078
if( wApp )
30793079
offset = wApp->environment().timeZoneOffset();
3080-
auto localtime = std::chrono::system_clock::now();
3080+
auto localtime = chrono::time_point_cast<chrono::microseconds>( chrono::system_clock::now() );
30813081
localtime += std::chrono::seconds(60*offset);
30823082

30833083
out << "# Detector Response Function generated by InterSpec "

src/RelActCalcAuto.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4538,13 +4538,17 @@ void RelActAutoSolution::print_html_report( std::ostream &out ) const
45384538
local_time = Wt::WLocalDateTime::currentDateTime().toString("yyyyMMdd hh:mm:ss").toUTF8();
45394539
}else
45404540
{
4541-
const auto utc_ts = chrono::system_clock::now();
4541+
const auto utc_ts = chrono::time_point_cast<chrono::microseconds>( chrono::system_clock::now() );
45424542
utc_time = SpecUtils::to_common_string( utc_ts, true );
45434543

45444544

45454545
std::time_t current_time = std::chrono::system_clock::to_time_t(utc_ts);
45464546
struct tm current_local_time;
4547+
#if( defined( WIN32 ) )
4548+
localtime_s( &current_local_time, &current_time );
4549+
#else
45474550
localtime_r( &current_time, &current_local_time );
4551+
#endif
45484552
char buffer[64] = { '\0' };
45494553

45504554
//"9-Sep-2014 03:02:15 PM"

src/SpecMeasManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,8 +1441,8 @@ bool SpecMeasManager::handleMultipleDrfCsv( std::istream &input,
14411441
filename = filename.substr( 0, filename.size() - orig_extension.size() );
14421442

14431443
const int offset = wApp->environment().timeZoneOffset();
1444-
auto now = std::chrono::system_clock::now();
1445-
now += std::chrono::seconds(60*offset);
1444+
auto now = chrono::time_point_cast<chrono::microseconds>( chrono::system_clock::now() );
1445+
now += chrono::seconds(60*offset);
14461446

14471447
string timestr = SpecUtils::to_vax_string(now); //"2014-Sep-19 14:12:01.62"
14481448
const string::size_type pos = timestr.find( ' ' );

0 commit comments

Comments
 (0)