Comments (7)
I would have expected MacOSX to set the __ unix __ macro, so that we can use gettimeofday() but I guess not...
from mujs.
Yeah, it should probably set that macro since macOS is based on FreeBSD... I am surprised about that. Hmm, but the results indicate that it's not doing that. Since the output is using the "* 1000
" fallback...
I did see that macOS has gettimeofday()
so hopefully it's just a matter of using another macro to detect Macs.
from mujs.
It's also possible, if less likely, that gettimeofday
returns in seconds resolution.
from mujs.
That's probably not it...
The time is expressed in seconds and
microseconds since midnight (0 hour), January 1, 1970.
from mujs.
@ccxvii Not sure if true, but wm4: __unix__ sounds like something non-standard
(he's the main dev of mpv
and programs alldayerryday so if he says that he doesn't know what it is then it is probably something non-standard) ;-)
from mujs.
The __unix__
macro catches all the main Linux and BSD variants. Adding a check for __APPLE__
should do the trick. Let me know if it doesn't work.
from mujs.
@ccxvii Thanks, I wrote a small test:
#include <stdio.h>
#include <math.h>
#include <sys/time.h>
int main()
{
printf("Hello World\n");
#if defined(__unix__)
printf("unix\n");
#endif
#if defined(__APPLE__)
printf("apple\n");
#endif
struct timeval tv;
gettimeofday(&tv, NULL);
double tx = floor(tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0);
printf("%.f\n", tx);
}
Result on a Mac:
+ $ ./a.out
Hello World
apple
1512999085793
+ $ ./a.out
Hello World
apple
1512999086631
+ $ ./a.out
Hello World
apple
1512999087257
Thank you. That concludes that the new version will work.
Could you please consider tagging v1.0.2 so that distros pick it up with all these array sort and Mac fixes and recent memory leak fixes etc? Would be awesome! <3
from mujs.
Related Issues (20)
- multi-thread environment HOT 4
- BUG HOT 2
- Does not build on macOS
- Warnings
- Get rid of setjmp HOT 1
- Object.keys([2,3]) returns [] instead of ["0", "1"] HOT 2
- String.prototype.replace() with global regex doesn't resolve correctly $`
- A performance issue caused by loop. HOT 2
- Suggestion - macro to make multi-threaded calls single-threaded
- The shared library should be built with SONAME
- Incorrect linker flag to build shared-lib on darwin
- Calling the join function on a self-referential array leads to a stack overflow.
- Unable to assign the eval function to a variable. Error: invalid use of 'eval'
- SyntaxError caused by the trailing comma in the function parameters. HOT 4
- Is it possible to increase the default stack size? HOT 19
- mujs github slug available
- The length of multi-code point Unicode characters is incorrect. HOT 9
- Unversioned shared library HOT 1
- MuJS compiling JS into a file opcode HOT 1
- Object.keys and Object.getOwnPropertyNames on Array returns indices twice HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mujs.