W dniu 02.01.2019 o 16:32, JonY via Mingw-w64-public pisze:
> On 1/2/19 1:10 PM, Johannes Pfau wrote:
>> Hello all,
>>
>> I'm currently adding (some basic) MinGW support to the D code which
>> was recently merged into GCC9. The D runtime library already has full
>> windows support, developed by DMD and LLVM D compiler devs. However,
>> this needs MSVC runtime versions >= 120. So I'm now trying to add
>> proper support for targeting newer MSVC libs to the GCC/MinGW ecosystem. 
>>
>> It turns out libgomp uses _ftime, but this symbol is only exposed for
>> msvcrt.dll and I get linker errors for any other MSVC version.
>> Therefore this patch adds the _ftime aliases to all msvcr .def
>> files. According to timeb.h, there should be a _ftime symbol which
>> maps to _ftime64 on _WIN64 and _ftime32 for anything else.
>>
>> This is my first MinGW patch, so please feel free to point out if
>> there's anything wrong with the patch.
>> BTW: How do you handle branches for the patches? The attached patch
>> is against the v6.x branch.
>>
>> Best regards,
>> Johannes
> 
> 
> Ideally, the patch should be against master, and then cherry-picked to
> v6.x. If there are conflicts, please prepare the patch for both branches.
> 
> I'll let LH, Jacek and the others comment on the patch.

On page 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ftime-ftime32-ftime64?view=vs-2017
 there is an example program.

I've tested this example in 64-bit GCC msvcrt/msvcr120/ucrtbase + 32-bit GCC 
msvcrt/msvcr120/ucrtbase -- all works. Could you specify example that not works?

Regards,
Mateusz

Test results:

$ m64- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f64.exe f.c

Mateusz@Mateusz-i7 /f/t/ft
$ f64
Seconds since midnight, January 1, 1970 (UTC): 1546446966
Milliseconds: 416
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan 02 17:36:06.416 2019

Mateusz@Mateusz-i7 /f/t/ft
$ m64-12- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f64-12.exe f.c

Mateusz@Mateusz-i7 /f/t/ft
$ f64-12
Seconds since midnight, January 1, 1970 (UTC): 1546447001
Milliseconds: 583
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan 02 17:36:41.583 2019

Mateusz@Mateusz-i7 /f/t/ft
$ m64-14- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f64-14.exe f.c
f.c: In function 'main':
f.c:28:64: warning: format '%d' expects argument of type 'int', but argument 2 
has type 'time_t' {aka 'long long int'} [-Wformat=]
    printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
                                                            ~~~~^
                                                            %I64lld
    time1);
    ~~~~~

Mateusz@Mateusz-i7 /f/t/ft
$ f64-14
Seconds since midnight, January 1, 1970 (UTC): 1546447049
Milliseconds: 498
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan  2 17:37:29.498 2019

Mateusz@Mateusz-i7 /f/t/ft
$ m32- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f32.exe f.c
f.c: In function 'main':
f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', 
but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=]
    printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
                                                            ~~~~^
                                                            %ld
    time1);
    ~~~~~
f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', 
but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=]
    printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
                                                            ~~~~^
                                                            %ld
    time1);
    ~~~~~

Mateusz@Mateusz-i7 /f/t/ft
$ f32
Seconds since midnight, January 1, 1970 (UTC): 1546447100
Milliseconds: 970
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan 02 17:38:20.970 2019

Mateusz@Mateusz-i7 /f/t/ft
$ m32-12- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f32-12.exe f.c
f.c: In function 'main':
f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', 
but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=]
    printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
                                                            ~~~~^
                                                            %ld
    time1);
    ~~~~~
f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', 
but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=]
    printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
                                                            ~~~~^
                                                            %ld
    time1);
    ~~~~~

Mateusz@Mateusz-i7 /f/t/ft
$ f32-12
Seconds since midnight, January 1, 1970 (UTC): 1546447138
Milliseconds: 981
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan 02 17:38:58.981 2019

Mateusz@Mateusz-i7 /f/t/ft
$ m32-14- 82

Mateusz@Mateusz-i7 /f/t/ft
$ gcc -Wall -o f32-14.exe f.c
f.c: In function 'main':
f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', 
but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=]
    printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
                                                            ~~~~^
                                                            %ld
    time1);
    ~~~~~
f.c:28:64: warning: format '%d' expects argument of type 'int', but argument 2 
has type 'time_t' {aka 'long int'} [-Wformat=]
    printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n",
                                                            ~~~~^
                                                            %I64ld
    time1);
    ~~~~~

Mateusz@Mateusz-i7 /f/t/ft
$ f32-14
Seconds since midnight, January 1, 1970 (UTC): 27302421452351803
Milliseconds: 431
Minutes between UTC and local time: -60
Daylight savings time flag (1 means Daylight time is in effect): 0
The time is Wed Jan  2 17:39:23.431 2019



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to