Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Everybody needs a little love sometime; stop hacking and fall in love!


devel / comp.lang.c++ / Pure beauty

SubjectAuthor
o Pure beautyBonita Montero

1
Pure beauty

<ucqnto$3df6a$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1275&group=comp.lang.c%2B%2B#1275

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.Montero@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Pure beauty
Date: Thu, 31 Aug 2023 20:59:05 +0200
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <ucqnto$3df6a$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 31 Aug 2023 18:59:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ff70a7335e595a5f320387c3a69d8d92";
logging-data="3587274"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BpqJmPXzvGDnsepwdsNmYwG7/BIZez4g="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:2+QzyAFvEw5YLG5/t9bSoJSZBfs=
Content-Language: de-DE
 by: Bonita Montero - Thu, 31 Aug 2023 18:59 UTC

I wrote a small Win32 tool that combines time from Unix, start
from Windows and runas from Windows in one. For this I just needed
a function that processes the number of clock cycles spent by the
process into a string. I wanted to use iterator debugging as much
as possible so that the whole thing is as good as safe from out
-of-bound errors. Here is the function:

string formatClockCycles( uint64_t clockCycles, char separator )
{ char digits[32];
auto [end, ec] = to_chars( digits, std::end( digits ), clockCycles );
string_view svDigits( digits, end );
size_t dots = (svDigits.length() - 1) / 3;
string_view::iterator itDigits = svDigits.end();
string dottified;
dottified.resize( svDigits.length() + dots, '*' );
string::iterator itRet = dottified.end();
for( ; dots--; itDigits -= 3, itRet -= 4 )
copy( itDigits - 3, itDigits, itRet - 3 ),
itRet[-4] = separator;
copy( svDigits.begin(), itDigits, dottified.begin() );
return dottified;
}

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor