Comments (3)
diff --git a/8086tiny.c b/8086tiny.c
index 0d3e880..b3f16ab 100644
--- a/8086tiny.c
+++ b/8086tiny.c
@@ -6,7 +6,7 @@
// This work is licensed under the MIT License. See included LICENSE.TXT.
#include <time.h>
-#include <sys/timeb.h>
+#include <sys/time.h>
#include <memory.h>
#ifndef _WIN32
@@ -160,7 +160,7 @@ unsigned short *regs16, reg_ip, seg_override, file_index, wave_counter;
unsigned int op_source, op_dest, rm_addr, op_to_addr, op_from_addr, i_data0, i_data1, i_data2, scratch_uint, scratch2_uint, inst_counter, set_flags_type, GRAPHICS_X, GRAPHICS_Y, pixel_colors[16], vmem_ctr;
int op_result, disk[3], scratch_int;
time_t clock_buf;
-struct timeb ms_clock;
+struct timeval ms_clock;
#ifndef NO_GRAPHICS
SDL_AudioSpec sdl_audio = {44100, AUDIO_U8, 1, 0, 128};
@@ -668,9 +668,9 @@ int main(int argc, char **argv)
write(1, regs8, 1)
OPCODE 1: // GET_RTC
time(&clock_buf);
- ftime(&ms_clock);
+ gettimeofday(&ms_clock, NULL);
memcpy(mem + SEGREG(REG_ES, REG_BX,), localtime(&clock_buf), sizeof(struct tm));
- CAST(short)mem[SEGREG(REG_ES, REG_BX, 36+)] = ms_clock.millitm;
+ CAST(short)mem[SEGREG(REG_ES, REG_BX, 36+)] = ms_clock.tv_usec / 1000;
OPCODE 2: // DISK_READ
OPCODE_CHAIN 3: // DISK_WRITE
regs8[REG_AL] = ~lseek(disk[regs8[REG_DL]], CAST(unsigned)regs16[REG_BP] << 9, 0)
I used this for a different purpose, but it should solve your problem as well.
from 8086tiny.
Code changes work!
from 8086tiny.
Thank you! @chandradeepdey
from 8086tiny.
Related Issues (11)
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 8086tiny.