More MSVC compat details

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2023-05-07 17:22:09 +02:00
parent 518ad5d423
commit abdfcd78db
No known key found for this signature in database
GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 17 additions and 6 deletions

View File

@ -179,12 +179,15 @@ public:
This is exposed publicly in case you need to manipulate it directly
for performance reasons.
*/
#if defined(_MSC_VER)
__declspec (align (8))
#elif defined(CARLA_OS_64BIT)
__attribute__ ((aligned (8)))
#ifdef CARLA_OS_64BIT
#define WATER_ALIGN_SIZE 8
#else
__attribute__ ((aligned (4)))
#define WATER_ALIGN_SIZE 4
#endif
#ifdef _MSC_VER
__declspec (align (WATER_ALIGN_SIZE))
#else
__attribute__ ((aligned (WATER_ALIGN_SIZE)))
#endif
mutable volatile Type value;

View File

@ -32,7 +32,9 @@
# include <mach/mach_time.h>
#elif defined(CARLA_OS_WIN)
# include <mmsystem.h>
#else
#endif
#ifndef _MSC_VER
# include <sys/time.h>
#endif
@ -124,9 +126,15 @@ Time Time::getCurrentTime() noexcept
int64 Time::currentTimeMillis() noexcept
{
#ifdef _MSC_VER
struct _timeb t;
_ftime_s (&t);
return ((int64) t.time) * 1000 + t.millitm;
#else
struct timeval tv;
gettimeofday (&tv, nullptr);
return ((int64) tv.tv_sec) * 1000 + tv.tv_usec / 1000;
#endif
}
//==============================================================================