Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #126631 > unrolled thread

How do you do something like this?

Started byG B <gb@gb.com>
First post2018-02-13 01:35 +0000
Last post2018-03-05 14:48 +0200
Articles 20 — 12 participants

Back to article view | Back to comp.lang.c


Contents

  How do you do something like this? G B <gb@gb.com> - 2018-02-13 01:35 +0000
    Re: How do you do something like this? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-02-13 02:02 +0000
      Re: How do you do something like this? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2018-02-13 03:53 +0100
    Re: How do you do something like this? bartc <bc@freeuk.com> - 2018-02-13 11:50 +0000
      Re: How do you do something like this? legalize+jeeves@mail.xmission.com (Richard) - 2018-02-13 21:34 +0000
        Re: How do you do something like this? bartc <bc@freeuk.com> - 2018-02-13 22:01 +0000
    Re: How do you do something like this? Egor <egor@ruby.local> - 2018-02-13 13:56 +0200
      Re: How do you do something like this? Juha Nieminen <nospam@thanks.invalid> - 2018-02-19 06:28 +0000
        Re: How do you do something like this? Egor <egor@ruby.local> - 2018-02-23 02:48 +0200
          Re: How do you do something like this? "James R. Kuyper" <jameskuyper@verizon.net> - 2018-02-27 08:30 -0500
            Re: How do you do something like this? Keith Thompson <kst-u@mib.org> - 2018-02-27 09:07 -0800
            Re: How do you do something like this? Real Troll <Real.Troll@Trolls.com> - 2018-02-27 18:07 -0400
              Re: How do you do something like this? David Brown <david.brown@hesbynett.no> - 2018-02-28 09:59 +0100
                Re: How do you do something like this? Keith Thompson <kst-u@mib.org> - 2018-02-28 10:03 -0800
                  Re: How do you do something like this? David Brown <david.brown@hesbynett.no> - 2018-02-28 22:35 +0100
                    Re: How do you do something like this? Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-01 13:07 -0800
                      Re: How do you do something like this? Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-01 17:01 -0800
                      Re: How do you do something like this? Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-01 21:11 -0800
                Re: How do you do something like this? Steven Petruzzellis <frelwizzen@gmail.com> - 2018-03-01 13:53 -0800
            Re: How do you do something like this? Egor <egor@ruby.local> - 2018-03-05 14:48 +0200

#126631 — How do you do something like this?

FromG B <gb@gb.com>
Date2018-02-13 01:35 +0000
SubjectHow do you do something like this?
Message-ID<5a823f5c$0$716$14726298@news.sunsite.dk>
Who can provide a two or three liner code in C or C++ to create a clock 
like the one shown in this video?

<https://youtu.be/SVxcpL4AJGs>

Please watch it is full screen to know what I am asking about.

[toc] | [next] | [standalone]


#126633

FromBen Bacarisse <ben.usenet@bsb.me.uk>
Date2018-02-13 02:02 +0000
Message-ID<876071ir4g.fsf@bsb.me.uk>
In reply to#126631
G B <gb@gb.com> writes:

> Who can provide a two or three liner code in C or C++ to create a

Cross posting between C and C++ can lead to some... disagreements.  I
read this in comp.lang.c first and my answer pertains to C.

> clock like the one shown in this video?
>
> <https://youtu.be/SVxcpL4AJGs>

For the time part, lookup the functions time, localtime and strftime in
whatever C reference you like to use.

For the output part, lookup fputs (or printf), fflush and the meaning of
the special character denoted by the escape sequence \r.

Enough hints?  (I'm avoiding spoilers because I'm guessing this is some
sort of homework or assignment, and if not, at least some challenge
you've set for yourself.)

-- 
Ben.

[toc] | [prev] | [next] | [standalone]


#126634

From"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>
Date2018-02-13 03:53 +0100
Message-ID<p5tjue$6oj$1@dont-email.me>
In reply to#126633
On 13.02.2018 03:02, Ben Bacarisse wrote:
> G B <gb@gb.com> writes:
> 
>> Who can provide a two or three liner code in C or C++ to create a
> 
> Cross posting between C and C++ can lead to some... disagreements.  I
> read this in comp.lang.c first and my answer pertains to C.
> 
>> clock like the one shown in this video?
>>
>> <https://youtu.be/SVxcpL4AJGs>
> 
> For the time part, lookup the functions time, localtime and strftime in
> whatever C reference you like to use.
> 
> For the output part, lookup fputs (or printf), fflush and the meaning of
> the special character denoted by the escape sequence \r.
> 
> Enough hints?  (I'm avoiding spoilers because I'm guessing this is some
> sort of homework or assignment, and if not, at least some challenge
> you've set for yourself.)

In addition toe Ben's hints, check out `std::this_thread` for means to 
avoid using all too much CPU time.

Cheers & hth.,

- Alf

[toc] | [prev] | [next] | [standalone]


#126649

Frombartc <bc@freeuk.com>
Date2018-02-13 11:50 +0000
Message-ID<fiAgC.671$3X6.107@fx22.am4>
In reply to#126631
On 13/02/2018 01:35, G B wrote:
> Who can provide a two or three liner code in C or C++ to create a clock 
> like the one shown in this video?
> 
> <https://youtu.be/SVxcpL4AJGs>
> 
> Please watch it is full screen to know what I am asking about.
> 

Why does it have to be 3 lines?

Anyway this is something I tried in Windows, to do the kind of display 
shown in the video. I couldn't be bothered dealing with actual time:

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

int main(void) {
     int n=0;

     system("cls");

     while (1) {
         printf("%d\r",n);
         ++n;
         Sleep(1000);
     }
}


(This assumes the value being displayed will never get shorter. It will 
do eventually but it will be decades hence. A time display however will 
be probably always be the same width.)

-- 
bartc

[toc] | [prev] | [next] | [standalone]


#126680

Fromlegalize+jeeves@mail.xmission.com (Richard)
Date2018-02-13 21:34 +0000
Message-ID<p5vlku$79c$1@news.xmission.com>
In reply to#126649
[Please do not mail me a copy of your followup]

bartc <bc@freeuk.com> spake the secret code
<fiAgC.671$3X6.107@fx22.am4> thusly:

>     system("cls");

If you watch the video, it doesn't clear the screen.
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
            The Terminals Wiki <http://terminals-wiki.org>
     The Computer Graphics Museum <http://computergraphicsmuseum.org>
  Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

[toc] | [prev] | [next] | [standalone]


#126681

Frombartc <bc@freeuk.com>
Date2018-02-13 22:01 +0000
Message-ID<teJgC.12449$Nt6.11808@fx43.am4>
In reply to#126680
On 13/02/2018 21:34, Richard wrote:
> [Please do not mail me a copy of your followup]
> 
> bartc <bc@freeuk.com> spake the secret code
> <fiAgC.671$3X6.107@fx22.am4> thusly:
> 
>>      system("cls");
> 
> If you watch the video, it doesn't clear the screen.

Well, the screen was cleared at one point, if not by the program. 
Perhaps the OP wanted the screen cleared completely and didn't know how.

Anyway it's an easy fix; just delete that line.

-- 
bartc

[toc] | [prev] | [next] | [standalone]


#126650

FromEgor <egor@ruby.local>
Date2018-02-13 13:56 +0200
Message-ID<vb0ble-6f5.ln1@ruby.opensrc.club>
In reply to#126631
In comp.lang.c G B <gb@gb.com> wrote:
> Who can provide a two or three liner code in C or C++ to create a clock 
> like the one shown in this video?

Here's how it's done on windows. If you need a different time format
you'll need to use localtime and strftime.

#include <stdio.h>
#include <time.h>
#include <windows.h>
int main() {
	for(;;) {
		time_t t = time(NULL);
		char *str = ctime(&t);
		str[24] = '\0'; /* remove the newline from string */
		printf("\r%s", str);
		fflush(stdout);
		Sleep(500);
	}
}

To sleep on unix, use the following code (requires time.h):
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 500000000L; /* 500 million ns = 500 ms */
nanosleep(&ts, NULL);

[toc] | [prev] | [next] | [standalone]


#126851

FromJuha Nieminen <nospam@thanks.invalid>
Date2018-02-19 06:28 +0000
Message-ID<p6dqq1$1ra9$1@adenine.netfront.net>
In reply to#126650
In comp.lang.c++ Egor <egor@ruby.local> wrote:
>                 Sleep(500);

> nanosleep(&ts, NULL);

I thought C++11 introduced sleep_for(). Why not use the standard function?

[toc] | [prev] | [next] | [standalone]


#126998

FromEgor <egor@ruby.local>
Date2018-02-23 02:48 +0200
Message-ID<dv44me-h94.ln1@ruby.opensrc.club>
In reply to#126851
In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
> I thought C++11 introduced sleep_for(). Why not use the standard function?
OP posted the question to both comp.lang.c and comp.lang.c++, so I
provided a C-oriented answer.

Didn't know about sleep_for in C++ though, so thanks for your addition.

[toc] | [prev] | [next] | [standalone]


#127128

From"James R. Kuyper" <jameskuyper@verizon.net>
Date2018-02-27 08:30 -0500
Message-ID<15d6d799-4d29-cb8b-e7a4-1e48fbece7ad@verizon.net>
In reply to#126998
On 02/22/2018 07:48 PM, Egor wrote:
> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
>> I thought C++11 introduced sleep_for(). Why not use the standard function?
> OP posted the question to both comp.lang.c and comp.lang.c++, so I
> provided a C-oriented answer.

A C-oriented answer using C2011 could use thrd_sleep()

[toc] | [prev] | [next] | [standalone]


#127138

FromKeith Thompson <kst-u@mib.org>
Date2018-02-27 09:07 -0800
Message-ID<lnpo4qgy4b.fsf@kst-u.example.com>
In reply to#127128
"James R. Kuyper" <jameskuyper@verizon.net> writes:
> On 02/22/2018 07:48 PM, Egor wrote:
>> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
>>> I thought C++11 introduced sleep_for(). Why not use the standard function?
>> OP posted the question to both comp.lang.c and comp.lang.c++, so I
>> provided a C-oriented answer.
>
> A C-oriented answer using C2011 could use thrd_sleep()

It could, but support for the C11 <threads.h> is still uncommon.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#127149

FromReal Troll <Real.Troll@Trolls.com>
Date2018-02-27 18:07 -0400
Message-ID<p74ksb$1k43$1@gioia.aioe.org>
In reply to#127128
On 27/02/2018 13:30, James R. Kuyper wrote:
> On 02/22/2018 07:48 PM, Egor wrote:
>> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
>>> I thought C++11 introduced sleep_for(). Why not use the standard 
>>> function?
>> OP posted the question to both comp.lang.c and comp.lang.c++, so I
>> provided a C-oriented answer.
>
> A C-oriented answer using C2011 could use thrd_sleep()
>
This one doesn't even compile in any of the compiler I have tried:

GNU G++,
Embarcadero
Visual Studio 2010, 2013, 2015, 2017

> #include <threads.h>
> #include <time.h>
> #include <stdio.h>
 
> int main(void)
> {
>    printf("Time: %s", ctime(&(time_t){time(NULL)}));
>    thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec
>    printf("Time: %s", ctime(&(time_t){time(NULL)}));
> }

[toc] | [prev] | [next] | [standalone]


#127155

FromDavid Brown <david.brown@hesbynett.no>
Date2018-02-28 09:59 +0100
Message-ID<p75r22$a9o$1@dont-email.me>
In reply to#127149
On 27/02/18 23:07, Real Troll wrote:
> On 27/02/2018 13:30, James R. Kuyper wrote:
>> On 02/22/2018 07:48 PM, Egor wrote:
>>> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
>>>> I thought C++11 introduced sleep_for(). Why not use the standard
>>>> function?
>>> OP posted the question to both comp.lang.c and comp.lang.c++, so I
>>> provided a C-oriented answer.
>>
>> A C-oriented answer using C2011 could use thrd_sleep()
>>
> This one doesn't even compile in any of the compiler I have tried:
> 
> GNU G++,
> Embarcadero
> Visual Studio 2010, 2013, 2015, 2017
> 
>> #include <threads.h>
>> #include <time.h>
>> #include <stdio.h>
> 
>> int main(void)
>> {
>>    printf("Time: %s", ctime(&(time_t){time(NULL)}));
>>    thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec
>>    printf("Time: %s", ctime(&(time_t){time(NULL)}));
>> }
> 
> 

Works fine for me with gcc.  Did you remember to use "-std=c11", or a
gcc version new enough to have "-std=gnu11" as the default?  Did you use
a new enough gcc?  (I think 4.9 is needed.)  Did you use a library with
the right support (not a Windows gcc version that uses MS's old and
limited C libraries)?

[toc] | [prev] | [next] | [standalone]


#127162

FromKeith Thompson <kst-u@mib.org>
Date2018-02-28 10:03 -0800
Message-ID<lnh8q1gfea.fsf@kst-u.example.com>
In reply to#127155
David Brown <david.brown@hesbynett.no> writes:
> On 27/02/18 23:07, Real Troll wrote:
>> On 27/02/2018 13:30, James R. Kuyper wrote:
>>> On 02/22/2018 07:48 PM, Egor wrote:
>>>> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
>>>>> I thought C++11 introduced sleep_for(). Why not use the standard
>>>>> function?
>>>> OP posted the question to both comp.lang.c and comp.lang.c++, so I
>>>> provided a C-oriented answer.
>>>
>>> A C-oriented answer using C2011 could use thrd_sleep()
>>>
>> This one doesn't even compile in any of the compiler I have tried:
>> 
>> GNU G++,
>> Embarcadero
>> Visual Studio 2010, 2013, 2015, 2017
>> 
>>> #include <threads.h>
>>> #include <time.h>
>>> #include <stdio.h>
>> 
>>> int main(void)
>>> {
>>>    printf("Time: %s", ctime(&(time_t){time(NULL)}));
>>>    thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec
>>>    printf("Time: %s", ctime(&(time_t){time(NULL)}));
>>> }
>
> Works fine for me with gcc.  Did you remember to use "-std=c11", or a
> gcc version new enough to have "-std=gnu11" as the default?  Did you use
> a new enough gcc?  (I think 4.9 is needed.)  Did you use a library with
> the right support (not a Windows gcc version that uses MS's old and
> limited C libraries)?

On Linux systems, gcc typically uses GNU libc by default, and GNU
libc doesn't support <threads.h>.  Specifying -std=... doesn't help.
I don't think Visual Studio supports it either.  (<threads.h> is
optional, so this doesn't mean these implementations are non-conforming
as long as they predefine __STDC_NO_THREADS__.)

On Debian-based systems, you can install an alternative C library,
MUSL, which does support <threads.h>.  You have to use a wrapper
called musl-gcc to compile with it.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

[toc] | [prev] | [next] | [standalone]


#127167

FromDavid Brown <david.brown@hesbynett.no>
Date2018-02-28 22:35 +0100
Message-ID<p777bj$gbe$2@dont-email.me>
In reply to#127162
On 28/02/18 19:03, Keith Thompson wrote:
> David Brown <david.brown@hesbynett.no> writes:
>> On 27/02/18 23:07, Real Troll wrote:
>>> On 27/02/2018 13:30, James R. Kuyper wrote:
>>>> On 02/22/2018 07:48 PM, Egor wrote:
>>>>> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
>>>>>> I thought C++11 introduced sleep_for(). Why not use the standard
>>>>>> function?
>>>>> OP posted the question to both comp.lang.c and comp.lang.c++, so I
>>>>> provided a C-oriented answer.
>>>>
>>>> A C-oriented answer using C2011 could use thrd_sleep()
>>>>
>>> This one doesn't even compile in any of the compiler I have tried:
>>>
>>> GNU G++,
>>> Embarcadero
>>> Visual Studio 2010, 2013, 2015, 2017
>>>
>>>> #include <threads.h>
>>>> #include <time.h>
>>>> #include <stdio.h>
>>>
>>>> int main(void)
>>>> {
>>>>     printf("Time: %s", ctime(&(time_t){time(NULL)}));
>>>>     thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec
>>>>     printf("Time: %s", ctime(&(time_t){time(NULL)}));
>>>> }
>>
>> Works fine for me with gcc.  Did you remember to use "-std=c11", or a
>> gcc version new enough to have "-std=gnu11" as the default?  Did you use
>> a new enough gcc?  (I think 4.9 is needed.)  Did you use a library with
>> the right support (not a Windows gcc version that uses MS's old and
>> limited C libraries)?
> 
> On Linux systems, gcc typically uses GNU libc by default, and GNU
> libc doesn't support <threads.h>.  Specifying -std=... doesn't help.
> I don't think Visual Studio supports it either.  (<threads.h> is
> optional, so this doesn't mean these implementations are non-conforming
> as long as they predefine __STDC_NO_THREADS__.)
> 
> On Debian-based systems, you can install an alternative C library,
> MUSL, which does support <threads.h>.  You have to use a wrapper
> called musl-gcc to compile with it.
> 

Oh, you are correct.  The gcc I tested was using MUSL.

[toc] | [prev] | [next] | [standalone]


#127198

FromSteven Petruzzellis <frelwizzen@gmail.com>
Date2018-03-01 13:07 -0800
Message-ID<1645f924-a3d0-4a15-ac0d-bece85e92a58@googlegroups.com>
In reply to#127167
On Wednesday, February 28, 2018 at 2:36:00 PM UTC-7, David Brown wrote:
> On 28/02/18 19:03, Keith Thompson wrote:
> > David Brown <david.brown@hesbynett.no> writes:
> >> On 27/02/18 23:07, Real Troll wrote:
> >>> On 27/02/2018 13:30, James R. Kuyper wrote:
> >>>> On 02/22/2018 07:48 PM, Egor wrote:
> >>>>> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
> >>>>>> I thought C++11 introduced sleep_for(). Why not use the standard
> >>>>>> function?
> >>>>> OP posted the question to both comp.lang.c and comp.lang.c++, so I
> >>>>> provided a C-oriented answer.
> >>>>
> >>>> A C-oriented answer using C2011 could use thrd_sleep()
> >>>>
> >>> This one doesn't even compile in any of the compiler I have tried:
> >>>
> >>> GNU G++,
> >>> Embarcadero
> >>> Visual Studio 2010, 2013, 2015, 2017
> >>>
> >>>> #include <threads.h>
> >>>> #include <time.h>
> >>>> #include <stdio.h>
> >>>
> >>>> int main(void)
> >>>> {
> >>>>     printf("Time: %s", ctime(&(time_t){time(NULL)}));
> >>>>     thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec
> >>>>     printf("Time: %s", ctime(&(time_t){time(NULL)}));
> >>>> }
> >>
> >> Works fine for me with gcc.  Did you remember to use "-std=c11", or a
> >> gcc version new enough to have "-std=gnu11" as the default?  Did you use
> >> a new enough gcc?  (I think 4.9 is needed.)  Did you use a library with
> >> the right support (not a Windows gcc version that uses MS's old and
> >> limited C libraries)?
> > 
> > On Linux systems, gcc typically uses GNU libc by default, and GNU
> > libc doesn't support <threads.h>.  Specifying -std=... doesn't help.
> > I don't think Visual Studio supports it either.  (<threads.h> is
> > optional, so this doesn't mean these implementations are non-conforming
> > as long as they predefine __STDC_NO_THREADS__.)
> > 
> > On Debian-based systems, you can install an alternative C library,
> > MUSL, which does support <threads.h>.  You have to use a wrapper
> > called musl-gcc to compile with it.
> > 
> 
> Oh, you are correct.  The gcc I tested was using MUSL.



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Does this verify?
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJX5+dVAAoJELnOYK54exUC/I8QAInyqZ8DyrwYyRFNk3/irlUi
V4egKMBuYDBcR2GDPxNuUKRxLiGk+XtCtlpFrZ1grm83BgcxcZrCJjNN6YrEFz+L
C1MHjTkxXORdUVSl1x3zjMTpjtSuD4gG9AloWz/vJ4C3ezT5ofGS7cIKWeANS1u6
rMbQN93qpQfk9wtMvQYQqEkV3ADl2ieNVBFqGc1enrzWtFn6TQL4TQTdOktRmjQX
4y703Yw9u1XNkzaa1gmiZ9z3GGjiQVFy1oAZDLy4y2ixU36iYjTmK613VG+HWlyB
RHbGsm5ncHVWP9qedrugr5L7Q/ODVxXeLftc8ARot88woouspauiTH8DbP8ds/c5
zX5iszWF3Ys3AtvM7dBaYtPb00qHKJsGdVOYjb1A24odIsJUVQ+//KwRnuFOyv12
KHBPlOyIRW2H1MQye0wQmPdl84wEOfn979yuChDtvtN24d1mLf6V06/pGYSJHY+m
gIMW2E0+muoHPXsPsKZG3iAUELeb9kRVXd+vxKj4wC0SnsWfmXZkn+w0kntxL9zX
xiskhcTXXU1bhaFaqnaMDnGhzeLNCXnFrm1HCwbmCJyNDHN9S/mlM1VeWOHN9LBe
sTXj3pFF0Yv41zhNj+8k/lnP96vYAbW69yscQD7mCvq99xZtxxHPaxlZMPcEORsM
N3/ciHfNb8enkU1n3QId
=8eSw
-----END PGP SIGNATURE-----

- 
"You'll notice how quickly he loses interest when everything is about him. He clearly wants the attention"
Steven Petruzzellis, making the dumbest comment ever uttered.

[toc] | [prev] | [next] | [standalone]


#127214

FromSteven Petruzzellis <frelwizzen@gmail.com>
Date2018-03-01 17:01 -0800
Message-ID<983a4301-301d-41ad-b9f9-80c7301a8d74@googlegroups.com>
In reply to#127198
On Thursday, March 1, 2018 at 2:07:18 PM UTC-7, Steven Petruzzellis wrote:
> On Wednesday, February 28, 2018 at 2:36:00 PM UTC-7, David Brown wrote:
> > On 28/02/18 19:03, Keith Thompson wrote:
> > > David Brown <david.brown@hesbynett.no> writes:
> > >> On 27/02/18 23:07, Real Troll wrote:
> > >>> On 27/02/2018 13:30, James R. Kuyper wrote:
> > >>>> On 02/22/2018 07:48 PM, Egor wrote:
> > >>>>> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
> > >>>>>> I thought C++11 introduced sleep_for(). Why not use the standard
> > >>>>>> function?
> > >>>>> OP posted the question to both comp.lang.c and comp.lang.c++, so I
> > >>>>> provided a C-oriented answer.
> > >>>>
> > >>>> A C-oriented answer using C2011 could use thrd_sleep()
> > >>>>
> > >>> This one doesn't even compile in any of the compiler I have tried:
> > >>>
> > >>> GNU G++,
> > >>> Embarcadero
> > >>> Visual Studio 2010, 2013, 2015, 2017
> > >>>
> > >>>> #include <threads.h>
> > >>>> #include <time.h>
> > >>>> #include <stdio.h>
> > >>>
> > >>>> int main(void)
> > >>>> {
> > >>>>     printf("Time: %s", ctime(&(time_t){time(NULL)}));
> > >>>>     thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec
> > >>>>     printf("Time: %s", ctime(&(time_t){time(NULL)}));
> > >>>> }
> > >>
> > >> Works fine for me with gcc.  Did you remember to use "-std=c11", or a
> > >> gcc version new enough to have "-std=gnu11" as the default?  Did you use
> > >> a new enough gcc?  (I think 4.9 is needed.)  Did you use a library with
> > >> the right support (not a Windows gcc version that uses MS's old and
> > >> limited C libraries)?
> > > 
> > > On Linux systems, gcc typically uses GNU libc by default, and GNU
> > > libc doesn't support <threads.h>.  Specifying -std=... doesn't help.
> > > I don't think Visual Studio supports it either.  (<threads.h> is
> > > optional, so this doesn't mean these implementations are non-conforming
> > > as long as they predefine __STDC_NO_THREADS__.)
> > > 
> > > On Debian-based systems, you can install an alternative C library,
> > > MUSL, which does support <threads.h>.  You have to use a wrapper
> > > called musl-gcc to compile with it.
> > > 
> > 
> > Oh, you are correct.  The gcc I tested was using MUSL.
> 
> 
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> Does this verify?
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - https://gpgtools.org
> 
> iQIcBAEBCgAGBQJX5+dVAAoJELnOYK54exUC/I8QAInyqZ8DyrwYyRFNk3/irlUi
> V4egKMBuYDBcR2GDPxNuUKRxLiGk+XtCtlpFrZ1grm83BgcxcZrCJjNN6YrEFz+L
> C1MHjTkxXORdUVSl1x3zjMTpjtSuD4gG9AloWz/vJ4C3ezT5ofGS7cIKWeANS1u6
> rMbQN93qpQfk9wtMvQYQqEkV3ADl2ieNVBFqGc1enrzWtFn6TQL4TQTdOktRmjQX
> 4y703Yw9u1XNkzaa1gmiZ9z3GGjiQVFy1oAZDLy4y2ixU36iYjTmK613VG+HWlyB
> RHbGsm5ncHVWP9qedrugr5L7Q/ODVxXeLftc8ARot88woouspauiTH8DbP8ds/c5
> zX5iszWF3Ys3AtvM7dBaYtPb00qHKJsGdVOYjb1A24odIsJUVQ+//KwRnuFOyv12
> KHBPlOyIRW2H1MQye0wQmPdl84wEOfn979yuChDtvtN24d1mLf6V06/pGYSJHY+m
> gIMW2E0+muoHPXsPsKZG3iAUELeb9kRVXd+vxKj4wC0SnsWfmXZkn+w0kntxL9zX
> xiskhcTXXU1bhaFaqnaMDnGhzeLNCXnFrm1HCwbmCJyNDHN9S/mlM1VeWOHN9LBe
> sTXj3pFF0Yv41zhNj+8k/lnP96vYAbW69yscQD7mCvq99xZtxxHPaxlZMPcEORsM
> N3/ciHfNb8enkU1n3QId
> =8eSw
> -----END PGP SIGNATURE-----
> 
> - 
> "You'll notice how quickly he loses interest when everything is about him. He clearly wants the attention"
> Steven Petruzzellis, making the dumbest comment ever uttered.



Of course my timely statement stands proper and correct. Really, those of you who troll are not able to check yourselves anymore. Over and over, the claim is he wants to "talk tech", but Paul F. Riddle spends most of his time whining about "obsession". 

I'm guessing, after kill filtering all the trolling, it's essentially just two trolls mass producing 95% of the trollcrap. Obviously. And both downright unbalanced screwballs. 



-- 
Best CMS Solution of 2017
http://www.5z8.info/racist-raps_r6r3wf_best-russian-sites-for-bootleg-everything
http://www.5z8.info/hack-outlook_c6c9in_michaelangelo-virus
Jonas Eklundh Communication AB

[toc] | [prev] | [next] | [standalone]


#127229

FromSteven Petruzzellis <frelwizzen@gmail.com>
Date2018-03-01 21:11 -0800
Message-ID<a26575a8-62d6-4475-8f8f-7e2ebb3b9889@googlegroups.com>
In reply to#127198
On Thursday, March 1, 2018 at 2:07:18 PM UTC-7, Steven Petruzzellis wrote:
> On Wednesday, February 28, 2018 at 2:36:00 PM UTC-7, David Brown wrote:
> > On 28/02/18 19:03, Keith Thompson wrote:
> > > David Brown <david.brown@hesbynett.no> writes:
> > >> On 27/02/18 23:07, Real Troll wrote:
> > >>> On 27/02/2018 13:30, James R. Kuyper wrote:
> > >>>> On 02/22/2018 07:48 PM, Egor wrote:
> > >>>>> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
> > >>>>>> I thought C++11 introduced sleep_for(). Why not use the standard
> > >>>>>> function?
> > >>>>> OP posted the question to both comp.lang.c and comp.lang.c++, so I
> > >>>>> provided a C-oriented answer.
> > >>>>
> > >>>> A C-oriented answer using C2011 could use thrd_sleep()
> > >>>>
> > >>> This one doesn't even compile in any of the compiler I have tried:
> > >>>
> > >>> GNU G++,
> > >>> Embarcadero
> > >>> Visual Studio 2010, 2013, 2015, 2017
> > >>>
> > >>>> #include <threads.h>
> > >>>> #include <time.h>
> > >>>> #include <stdio.h>
> > >>>
> > >>>> int main(void)
> > >>>> {
> > >>>>     printf("Time: %s", ctime(&(time_t){time(NULL)}));
> > >>>>     thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec
> > >>>>     printf("Time: %s", ctime(&(time_t){time(NULL)}));
> > >>>> }
> > >>
> > >> Works fine for me with gcc.  Did you remember to use "-std=c11", or a
> > >> gcc version new enough to have "-std=gnu11" as the default?  Did you use
> > >> a new enough gcc?  (I think 4.9 is needed.)  Did you use a library with
> > >> the right support (not a Windows gcc version that uses MS's old and
> > >> limited C libraries)?
> > > 
> > > On Linux systems, gcc typically uses GNU libc by default, and GNU
> > > libc doesn't support <threads.h>.  Specifying -std=... doesn't help.
> > > I don't think Visual Studio supports it either.  (<threads.h> is
> > > optional, so this doesn't mean these implementations are non-conforming
> > > as long as they predefine __STDC_NO_THREADS__.)
> > > 
> > > On Debian-based systems, you can install an alternative C library,
> > > MUSL, which does support <threads.h>.  You have to use a wrapper
> > > called musl-gcc to compile with it.
> > > 
> > 
> > Oh, you are correct.  The gcc I tested was using MUSL.
> 
> 
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> Does this verify?
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - https://gpgtools.org
> 
> iQIcBAEBCgAGBQJX5+dVAAoJELnOYK54exUC/I8QAInyqZ8DyrwYyRFNk3/irlUi
> V4egKMBuYDBcR2GDPxNuUKRxLiGk+XtCtlpFrZ1grm83BgcxcZrCJjNN6YrEFz+L
> C1MHjTkxXORdUVSl1x3zjMTpjtSuD4gG9AloWz/vJ4C3ezT5ofGS7cIKWeANS1u6
> rMbQN93qpQfk9wtMvQYQqEkV3ADl2ieNVBFqGc1enrzWtFn6TQL4TQTdOktRmjQX
> 4y703Yw9u1XNkzaa1gmiZ9z3GGjiQVFy1oAZDLy4y2ixU36iYjTmK613VG+HWlyB
> RHbGsm5ncHVWP9qedrugr5L7Q/ODVxXeLftc8ARot88woouspauiTH8DbP8ds/c5
> zX5iszWF3Ys3AtvM7dBaYtPb00qHKJsGdVOYjb1A24odIsJUVQ+//KwRnuFOyv12
> KHBPlOyIRW2H1MQye0wQmPdl84wEOfn979yuChDtvtN24d1mLf6V06/pGYSJHY+m
> gIMW2E0+muoHPXsPsKZG3iAUELeb9kRVXd+vxKj4wC0SnsWfmXZkn+w0kntxL9zX
> xiskhcTXXU1bhaFaqnaMDnGhzeLNCXnFrm1HCwbmCJyNDHN9S/mlM1VeWOHN9LBe
> sTXj3pFF0Yv41zhNj+8k/lnP96vYAbW69yscQD7mCvq99xZtxxHPaxlZMPcEORsM
> N3/ciHfNb8enkU1n3QId
> =8eSw
> -----END PGP SIGNATURE-----
> 
> - 
> "You'll notice how quickly he loses interest when everything is about him. He clearly wants the attention"
> Steven Petruzzellis, making the dumbest comment ever uttered.



Tizen, runs on the MATE kernel. So yeah, MATE is mobile. MATE is a super computer. MATE is a server. MATE is a desktop. MATE is growing in market share. 

The whole sham is chock-full of ridiculous inconsistencies and counts heavily on God's 'ridingPaul F. Riddle's ass' gag. And in reply you have nothing but an attempt to start something. I bet God does not even know what is wrong with Trump. God wants to hurt everyone here: If he can't be the focus here then nobody will. 

Now let us see knows Python, is an avid scripter, has hacked Paul F. Riddle's ID, has passion for this shit and is a huge tantrum throwingloser who, when he gets a bad case of narcissistic rage/injury going, posts endless nonsense even when he's *not* flooding... AND... who works to attributes everything he is doing on "anyone he can" and has for years? 

I have worked in or with the computer field for more than 35 years. I've done business with top OEMs selling to the aeronautics industry and the communications industry. Never, not even once, were we on any account told not to offer any OS we wanted. We sold Xenix, Apple II, HP-UX, among others as well as Microsoft OSs with no issues. 



--
Get Rich Slow!
http://www.5z8.info/freeanimalporn.com-start-download_s9j7do_dogporn
Jonas Eklundh Communication AB

[toc] | [prev] | [next] | [standalone]


#127203

FromSteven Petruzzellis <frelwizzen@gmail.com>
Date2018-03-01 13:53 -0800
Message-ID<6eea589f-8ec9-44db-8430-2f8e330d4a02@googlegroups.com>
In reply to#127155
On Wednesday, February 28, 2018 at 2:00:03 AM UTC-7, David Brown wrote:
> On 27/02/18 23:07, Real Troll wrote:
> > On 27/02/2018 13:30, James R. Kuyper wrote:
> >> On 02/22/2018 07:48 PM, Egor wrote:
> >>> In comp.lang.c Juha Nieminen <nospam@thanks.invalid> wrote:
> >>>> I thought C++11 introduced sleep_for(). Why not use the standard
> >>>> function?
> >>> OP posted the question to both comp.lang.c and comp.lang.c++, so I
> >>> provided a C-oriented answer.
> >>
> >> A C-oriented answer using C2011 could use thrd_sleep()
> >>
> > This one doesn't even compile in any of the compiler I have tried:
> > 
> > GNU G++,
> > Embarcadero
> > Visual Studio 2010, 2013, 2015, 2017
> > 
> >> #include <threads.h>
> >> #include <time.h>
> >> #include <stdio.h>
> > 
> >> int main(void)
> >> {
> >>    printf("Time: %s", ctime(&(time_t){time(NULL)}));
> >>    thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec
> >>    printf("Time: %s", ctime(&(time_t){time(NULL)}));
> >> }
> > 
> > 
> 
> Works fine for me with gcc.  Did you remember to use "-std=c11", or a
> gcc version new enough to have "-std=gnu11" as the default?  Did you use
> a new enough gcc?  (I think 4.9 is needed.)  Did you use a library with
> the right support (not a Windows gcc version that uses MS's old and
> limited C libraries)?



I am working on a program which will be more than anything Allah can do! 

Just look at your posts and look at Vennie Bowden's, there is nothing for Vennie Bowden to learn from a jerk like Allah. But hey, let him keep making an idiot of himself. I am sure one of his stooges will come to the rescue. Perhaps you use it incorrectly. Do you not fathom the use of encryption? Thanks to Allah and his 'co-trolls' you now need a reverse spam filter (which I programmed for KDE and Windows Mail). Dig through the archives, for the most part I stopped giving him what he deserves. If others start up with him again I will slip in my resolve... as if for not other reason than to get revenge. I am referring to our clan here, not socks, who talk to him no matter what. 

Don't look now, but I think Allah has a serious mancrush on Vennie Bowden. You likely think Ubuntu handles the desktop well. Nope. Not compared to Windows. 

The Mack has a more consistent interface. Allah will never live that down. An unceasing, fierce, posting itch, despite nothing to say - essentially slimy worm camp followers, and vigorously-greased ram, deactivated with wit for his own secret needs. 

- 
Eight things to never feed your dog
http://alt.conspiracy.narkive.com/QcWYJ4Px/the-mentally-ill-mark-s-bilk
Jonas Eklundh Communication AB

[toc] | [prev] | [next] | [standalone]


#127367

FromEgor <egor@ruby.local>
Date2018-03-05 14:48 +0200
Message-ID<luqvme-c9e.ln1@ruby.opensrc.club>
In reply to#127128
In comp.lang.c James R. Kuyper <jameskuyper@verizon.net> wrote:
> A C-oriented answer using C2011 could use thrd_sleep()
Sadly, C11 support is still trash.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c


csiph-web