Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
unistd.cpp File Reference
#include "unistd.h"
#include <cstdint>
#include <chrono>
#include <thread>
#include <windows.h>
+ Include dependency graph for unistd.cpp:

Go to the source code of this file.

Functions

int usleep (unsigned usec)
 
int gettimeofday (struct timeval *tp, struct timezone *tzp)
 

Function Documentation

◆ gettimeofday()

int gettimeofday ( struct timeval *  tp,
struct timezone *  tzp 
)
22{
23 // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's
24 // This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC)
25 // until 00:00:00 January 1, 1970
26 static const std::uint64_t EPOCH = ((std::uint64_t) 116444736000000000ULL);
27
28 SYSTEMTIME system_time;
29 FILETIME file_time;
30 std::uint64_t time;
31
32 GetSystemTime(&system_time);
33 SystemTimeToFileTime(&system_time, &file_time);
34 time = ((std::uint64_t)file_time.dwLowDateTime);
35 time += ((std::uint64_t)file_time.dwHighDateTime) << 32;
36
37 tp->tv_sec = (long)((time - EPOCH) / 10000000L);
38 tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
39 return 0;
40}
wchar_t const wchar_t unsigned long
Definition windows.hpp:29

References long.

Referenced by avr_write_byte_default(), igl::Timer::getElapsedTimeInMicroSec(), hid_read_timeout(), jtagmkII_recv_frame(), report_progress(), igl::Timer::start(), stk500v2_recv(), and igl::Timer::stop().

+ Here is the caller graph for this function:

◆ usleep()

int usleep ( unsigned  usec)
14{
15 std::this_thread::sleep_for(std::chrono::microseconds(usec));
16 return 0;
17}

Referenced by arduino_open(), avr910_chip_erase(), avr910_paged_write_eeprom(), avr910_paged_write_flash(), avr_write_byte_default(), avr_write_page(), avrdude_main(), bitbang_chip_erase(), bitbang_initialize(), buspirate_chip_erase(), buspirate_start_mode_bin(), butterfly_initialize(), butterfly_paged_write(), jtagmkII_smc_init32(), stk500_chip_erase(), stk500hv_chip_erase(), stk500isp_write_byte(), stk500v2_chip_erase(), stk500v2_initialize(), and wiring_open().

+ Here is the caller graph for this function: