Skip to content

Commit f9cb65a

Browse files
committed
Disble time measurement with MSVC compiler
1 parent d720094 commit f9cb65a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

mcstas-comps/examples/Prototypes/ODIN_TOF_train4/ODIN_TOF_train4.instr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@ total_arrived=0;
142142
total_N_sent=0;
143143
total_rays_sent=0;
144144

145+
// Don't measure time on windows, CLOCK_REALTIME
146+
// macro is unknown...
147+
// It is indicated in this oagehttps://learn.microsoft.com/en-us/answers/questions/2147256/clock-realtime-is-undefined-in-visual-studio-but-c that it might work to add a high enough _POSIX_C_SOURCE define, i.e.
148+
// #define _POSIX_C_SOURCE 199309L.
145149

150+
#ifndef _MSC_EXTENSIONS
146151
MPI_MASTER(
147152
struct timespec ts;
148153

@@ -162,6 +167,7 @@ MPI_MASTER(
162167
fprintf(f, "%.9f\n", wall_time);
163168
fclose(f);
164169
);
170+
#endif
165171
%}
166172

167173
TRACE
@@ -998,7 +1004,7 @@ AT (0, 0, 60.5) RELATIVE optical_axis_backend
9981004

9991005
SAVE
10001006
%{
1001-
1007+
#ifndef _MSC_EXTENSIONS
10021008
MPI_MASTER(
10031009
struct timespec ts;
10041010

@@ -1017,7 +1023,8 @@ SAVE
10171023

10181024
fprintf(f, "%.9f\n", wall_time);
10191025
fclose(f);
1020-
);
1026+
);
1027+
#endif
10211028
%}
10221029

10231030
FINALLY

0 commit comments

Comments
 (0)