Changeset 3060 in kBuild for trunk/src/kmk/kmkbuiltin/mscfakes.c
- Timestamp:
- Sep 21, 2017 3:11:07 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/mscfakes.c
r2901 r3060 37 37 #include <fcntl.h> 38 38 #include <sys/stat.h> 39 #include <sys/timeb.h> 39 40 #include "err.h" 40 41 #include "mscfakes.h" 42 43 #include "nt/ntutimes.h" 44 #undef utimes 45 #undef lutimes 41 46 42 47 #define timeval windows_timeval 43 48 #include <Windows.h> 44 49 #undef timeval 50 45 51 46 52 /******************************************************************************* … … 460 466 461 467 462 int utimes(const char *pszPath, const struct timeval *paTimes)463 {464 /** @todo implement me! */465 return 0;466 }467 468 469 468 /* We override the libc write function (in our modules only, unfortunately) so 470 469 we can kludge our way around a ENOSPC problem observed on build servers … … 651 650 652 651 652 int utimes(const char *pszPath, const struct timeval *paTimes) 653 { 654 BirdTimeVal_T aTimes[2]; 655 aTimes[0].tv_sec = paTimes[0].tv_sec; 656 aTimes[0].tv_usec = paTimes[0].tv_usec; 657 aTimes[1].tv_sec = paTimes[1].tv_sec; 658 aTimes[1].tv_usec = paTimes[1].tv_usec; 659 return birdUtimes(pszPath, aTimes); 660 } 661 662 663 int lutimes(const char *pszPath, const struct timeval *paTimes) 664 { 665 BirdTimeVal_T aTimes[2]; 666 aTimes[0].tv_sec = paTimes[0].tv_sec; 667 aTimes[0].tv_usec = paTimes[0].tv_usec; 668 aTimes[1].tv_sec = paTimes[1].tv_sec; 669 aTimes[1].tv_usec = paTimes[1].tv_usec; 670 return birdUtimes(pszPath, aTimes); 671 } 672 673 674 int gettimeofday(struct timeval *pNow, void *pvIgnored) 675 { 676 struct __timeb64 Now; 677 int rc = _ftime64_s(&Now); 678 if (rc == 0) 679 { 680 pNow->tv_sec = Now.time; 681 pNow->tv_usec = Now.millitm * 1000; 682 return 0; 683 } 684 errno = rc; 685 return -1; 686 } 687 688 689 struct tm *localtime_r(const __time64_t *pNow, struct tm *pResult) 690 { 691 int rc = _localtime64_s(pResult, pNow); 692 if (rc == 0) 693 return pResult; 694 errno = rc; 695 return NULL; 696 } 697 698 699 __time64_t timegm(struct tm *pNow) 700 { 701 return _mkgmtime64(pNow); 702 } 703 704 653 705 /** 654 706 * Checks if the given file descriptor is a pipe or not.
Note:
See TracChangeset
for help on using the changeset viewer.