masinter has quit [Remote host closed the connection]
habamax has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1)]
zetef has joined #commonlisp
rgherdt has joined #commonlisp
HamzaShahid has joined #commonlisp
<HamzaShahid>
Hello Everyone!
<MelanieMalik>
Goodbye Everyone!
<HamzaShahid>
Been quite some time. I finally started working on a real project on a investing simulator. Had to make everything on my own so I used Radiance (the library made by shinmera). It worked like a charm. I am on the last stages of the application. However, I am having a little trouble with dates
<HamzaShahid>
Basically, I want to start a timer until a specific date or some form of countdown on the main server. I could (decode-universal-time) but how would I get remaining time?
<HamzaShahid>
Can it be done without libraries like local-time?
<Shinmera>
(- (encode-universal-time date you want to have) (get-universal-time)) => seconds until that time
<HamzaShahid>
Oh... yeah ofcourse. Also thanks Shinmera for your efforts! I love your libraries!
<Shinmera>
Glad to hear! :)
zetef has quit [Ping timeout: 246 seconds]
<HamzaShahid>
I do not want to disturb this server much but just referring to the modules, can I also connect a redis-server with a postgresql database? Like use 2 databases with 2 different connections with your interface? Currently I am using cl-redis and in the db:trigger just handling that separately.
<Shinmera>
Not as it is designed, no
<Shinmera>
since the intention is for the implementation to override functions in the db package, there's not really a way for two to do so at the same time
tengu1 has joined #commonlisp
<Shinmera>
but I think for cases like that where you need to rely on a specific db implementation for a specific part, it's more than fine to just use that directly where needed, rather than going through the interfaces.
<Shinmera>
the point of the interface is to give administrators some control over the setup
<HamzaShahid>
Ah, I see. Cool.
szkl has joined #commonlisp
<HamzaShahid>
Also in the (get-universal-time) thing, there will not be a timezone issue right?
rogersm has joined #commonlisp
dcb has quit [Quit: MSN Messenger 4.1.1]
deadmarshal_ has quit [Server closed connection]
rogersm has quit [Remote host closed the connection]
<Shinmera>
universal times are always in UTC
<Shinmera>
so, timezone-less
<Shinmera>
but in encode-universal-time (and decode-) you can pass a timezone offset
rogersm has joined #commonlisp
<HamzaShahid>
so GMT+5 will be -5? I do not get the logic of this
<Shinmera>
no, the offset is +5
<Shinmera>
if you want to parse a timestring like RFC3339 or something that is more human-readable, you'll need a library like local-time or https://github.com/shinmera/fuzzy-dates
<ixelp>
GitHub - Shinmera/fuzzy-dates: A library to fuzzily parse date and time strings
<HamzaShahid>
Damn even a date parser??!?1
deadmarshal_ has joined #commonlisp
<Shinmera>
as for encode/decode-universal-time, iirc not passing anything will take the machine's timezone, and passing NIL will use UTC.
rogersm has quit [Ping timeout: 264 seconds]
X-Scale has quit [Ping timeout: 250 seconds]
<HamzaShahid>
I understand but am very confused as I know my country (Pakistan) is GMT+5 but the correct time is given by only (decode-universal-time (get-universal-time) -5)
<ixelp>
timezone - Time zones `Etc/GMT`, why it is other way round? - Stack Overflow
<HamzaShahid>
"The reason is for backwards compatibility with POSIX style time zone identifiers" ofcourse...
<HamzaShahid>
Ohhhh: "These entries are mostly present for historical reasons, so that people in areas not otherwise covered by the tz files could "zic -l" to a time zone that was right for their area."
<HamzaShahid>
Very cool anyways, thank you.
<aeth>
of course it's posix
rogersm has quit [Remote host closed the connection]
<HamzaShahid>
yeah
<aeth>
I guess we can blame everything in computing on posix
rogersm has joined #commonlisp
<aeth>
I always thought it was weird that the time zones were backwards, but I never thought to look it up
<HamzaShahid>
Well you learn something new everyday. Would have never come to common lisp if I did not search random things curiously. Thinking about it now, I think I started with newLisp for another scripting alternative to bash hahaha. Lead to common lisp
<aeth>
where did you find newlisp?
<HamzaShahid>
Oh, I barely remember even though it was not very long ago. I think it was a github repo and someone had used common lisp but for some reason, github thought it was newLisp. I loved learning new random languages at that time so I was intrigued.
<aeth>
oh, yeah, that's a common issue
<HamzaShahid>
It was the guy who made the opengl series while shinmera was making trial
<aeth>
the Ruby library "linguist" misidentifies .lisp files as newLisp all of the time because the heuristic for newLisp is "define" and that can exist in Common Lisp (e.g. define-condition)
<aeth>
this affects Github and Gitlab
<Shinmera>
ah, baggers?
<HamzaShahid>
Yeahhhhh
<HamzaShahid>
I loved that series learnt so much from him. He is living in the middle of nowhere now right? Barely could get his internet fixed.
<aeth>
oh yeah that was a cool engine
<HamzaShahid>
I watched it in August of 2020 or 21' I can't really remember
<Shinmera>
I still chat with baggers occasionally, he's doing good.
<HamzaShahid>
Okay, so now I have the time interval down, but how do I actually run it exactly on that time? For example, on 5/11/2024 at 2:30 and 1 second, run this function. (sleep) or should I use simple-task?
easye has quit [Remote host closed the connection]
<HamzaShahid>
Shinmera: That is good to hear :D
<Shinmera>
typically what you do is run a loop that checks whether the time has been reached yet, and if not sleep until that time
<Shinmera>
the reason for the loop is that the sleep may be interrupted early.
easye has joined #commonlisp
<HamzaShahid>
wait what? What is the reason of sleep then?
<Shinmera>
so your thread doesn't consume an entire core
<HamzaShahid>
larix1: In this case seconds are very important as it is a game like simulator
<Shinmera>
simple-tasks doesn't do scheduling until a specific time
<Shinmera>
but as you can see from the task-runner, it's not much to implement that
<Shinmera>
anyway, I need to run
<Shinmera>
good luck
<HamzaShahid>
Okay buy! Thanks again.
<larix1>
run!
<HamzaShahid>
lol, yeah so I see, there is some code I don't really understand there
<HamzaShahid>
will try boxing it out in the REPL first
mgl_ has quit [Ping timeout: 240 seconds]
attila_lendvai has joined #commonlisp
shka has joined #commonlisp
bendersteed has joined #commonlisp
anticrisis has quit [Read error: Connection reset by peer]
d4ryus has quit [Ping timeout: 246 seconds]
dino_tutter has joined #commonlisp
d4ryus has joined #commonlisp
X-Scale has joined #commonlisp
rendar has quit [Server closed connection]
<jcowan>
The reversal isn't Posix, it's the U.S. Department of Defense, which expresses numeric time zones as time before UTC rather than after it, probably so that the U.S. would be in positive time zones.
habamax has joined #commonlisp
<beach>
Off topic, I know, but it always amazes me how the US ignores many international conventions.
<aeth>
following standards is a sign of weakness, see e.g. Microsoft
<jcowan>
The Roman Empire did too, and for the same reasons.
<jcowan>
However, in this case the U.S. standard predated the international one (the same is true of SI)
<aeth>
dates are a mess, few countries follow the international convention
<beach>
jcowan: Most countries had different conventions before SI, but they were able to switch.
<aeth>
and dates tend to be tied to the locale, even though they're fairly arbitrary... I often set my locale to Canada to get ISO 8601
easye has quit [Ping timeout: 260 seconds]
<beach>
And Sweden (where I grew up) switched to ISO-8601 more than 50 years ago.
<jcowan>
They had too many conventions and had to deal with their neighbors. IIRC, pre-revolutionary France had about 200 weights-and-measures conventions.
<larix1>
blame the pirates who sunk our meter and kilogram :(
X-Scale has quit [Ping timeout: 250 seconds]
<jcowan>
the Imperial Federation of America traded mostly with itself
<jcowan>
(and still does)
<jcowan>
Not that I defend this; I think it's stupid.
<moon-child>
canada is fun because we have to deal with both the american and the european standards
* jcowan
nods
<larix1>
i mean we have to deal with both in america too
<larix1>
a lot of old things, like land being surveyed and divided on the mile, cant be changed now
<moon-child>
go to the grocery store and some thing are measured in kilos and others in lbs
<beach>
aeth: Yes, France is surprisingly bad, given their history.
<moon-child>
my oven reads F, and my thermostat C
easye has joined #commonlisp
<aeth>
For the most part, food in the US is in both metric and imperial, usually with metric in parentheses, although whichever number is the "round number" is probably what it was actually made in. For instance, something that's "16.9 FL OZ (500 mL)" is using metric whether they want to admit it or not.
<aeth>
Cooking in the US, however, is entirely imperial. Not like most people cook anymore other than the microwave.
<larix1>
I had an jeep with parts all metric, now i have a toyota with parts all imperial, makes no sense
<aeth>
Celsius is imo pretty bad for thermostats, at least if limited to 2 digits instead of 3 digits (even if the third digit is just .5 or .0)
<aeth>
you have (roughly) half as many temperatures you can set things to if you use 2 digits
<jcowan>
aeth: What's curious about U.S. cooking isn't the (non-)imperial units, its the use of volumetric units. We add ingredients by the cup (approx. 250 ml) rather than the gram.
<jcowan>
Kitchen scales are not a thing here.
<aeth>
if you had a (metric!) kitchen scale, I'm sure the authorities would assume you're a drug dealer
<beach>
jcowan: What, that's pretty bad for things like flour.
varjag has joined #commonlisp
<jcowan>
You fill a container and then scrape the excess of the top with a planar object such as a piece of paper. Again, premature standardization.
<jcowan>
s/of the top/off the top
zetef has joined #commonlisp
garlic has joined #commonlisp
<jcowan>
larix1: Land measurements are in dunams pretty much throughout former Ottoman territory
donleo has joined #commonlisp
<aeth>
I'd assume that plots of land would be the hardest thing to change
<aeth>
few things operate on that kind of time scale
<larix1>
i used to do survey work... i still dont know how many feet are in a mile off the top of my head
<jcowan>
5280
rogersm has quit [Remote host closed the connection]
<aeth>
oh I should probably just misremember 5300
<aeth>
because I always know it's in the ballpark of 5200
<aeth>
but 5300 is more accurate
<aeth>
I also know it's roughly 1776 yards (it's actually 1760 yards, but it would be very American for it to be 1776 yards)
igemnace has quit [Read error: Connection reset by peer]
<jcowan>
the reason I said "(non-)imperial" is that American units forked off British ones and sometimes retain older values. Thus the hundredweight is 100 lb in America, 112 lb in the UK, because in the UK it was changed to be exactly 8 stone (1 stone = 14 lb), but stone was abandoned as a unit of weight here, so no need to make the change. Similarly, most imperial units of volume are about 5/4 the size of the identically named US ones
siw5ohs0 has joined #commonlisp
siw5ohs0 has left #commonlisp [Leaving]
rogersm has joined #commonlisp
garlic has quit [Remote host closed the connection]
danse-nr3 has joined #commonlisp
dnhester26 has joined #commonlisp
rogersm has quit [Ping timeout: 258 seconds]
rogersm has joined #commonlisp
igemnace has joined #commonlisp
ec has quit [Read error: Connection reset by peer]
ec has joined #commonlisp
tengu1 has quit [Quit: Client closed]
rogersm has quit [Ping timeout: 260 seconds]
triffid has quit [Remote host closed the connection]
szkl has quit [Quit: Connection closed for inactivity]
triffid has joined #commonlisp
X-Scale has joined #commonlisp
Lycurgus_ has joined #commonlisp
Lycurgus_ has quit [Client Quit]
rogersm has joined #commonlisp
akonai has joined #commonlisp
akonai_ has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
akonai has quit [Ping timeout: 240 seconds]
markb1 has quit [Ping timeout: 252 seconds]
rogersm has quit [Ping timeout: 246 seconds]
jmdaemon has quit [Ping timeout: 246 seconds]
thollief has joined #commonlisp
mgl_ has joined #commonlisp
makomo has joined #commonlisp
random-nick has joined #commonlisp
markb1 has joined #commonlisp
beach` has joined #commonlisp
beach has quit [Killed (NickServ (GHOST command used by beach`!~user@2a01:cb19:f85:d900:85f6:8880:8dc8:8744))]
beach` is now known as beach
yitzi has joined #commonlisp
rogersm has joined #commonlisp
rogersm has quit [Ping timeout: 260 seconds]
rogersm has joined #commonlisp
zetef has quit [Ping timeout: 260 seconds]
rogersm has quit [Client Quit]
Gleefre has quit [Ping timeout: 250 seconds]
amb007 has quit [Ping timeout: 252 seconds]
<pfdietz>
The great thing about standards is there's so many to choose from.
amb007 has joined #commonlisp
aeth has quit [Server closed connection]
kevingal has joined #commonlisp
aeth has joined #commonlisp
dnhester26 has joined #commonlisp
msavoritias has joined #commonlisp
chomwitt has quit [Ping timeout: 260 seconds]
vjalmr has joined #commonlisp
kevingal_ has joined #commonlisp
rendar has joined #commonlisp
rendar has quit [Changing host]
rendar has joined #commonlisp
X-Scale has quit [Ping timeout: 250 seconds]
tyson2 has joined #commonlisp
yitzi has quit [Remote host closed the connection]
danse-nr3 has quit [Ping timeout: 255 seconds]
danse-nr3 has joined #commonlisp
chomwitt has joined #commonlisp
yitzi has joined #commonlisp
lucasta has joined #commonlisp
lottaquestions has quit [Quit: Konversation terminated!]
dcb has joined #commonlisp
easye has quit [Remote host closed the connection]
lottaquestions has joined #commonlisp
triffid has quit [Remote host closed the connection]
triffid has joined #commonlisp
green_ has quit [Ping timeout: 246 seconds]
habamax has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.1.90)]
edr has joined #commonlisp
attila_lendvai has quit [Ping timeout: 258 seconds]
avocadoist has joined #commonlisp
triffid has quit [Remote host closed the connection]
triffid has joined #commonlisp
lucasta has quit [Quit: Leaving]
lucasta has joined #commonlisp
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
vjalmr has quit [Quit: Terminated!]
avocadoist has quit [Remote host closed the connection]
xlymian has joined #commonlisp
green_ has joined #commonlisp
jeffrey has joined #commonlisp
danse-nr3 has quit [Ping timeout: 260 seconds]
avocadoist has joined #commonlisp
zetef has joined #commonlisp
zetef has quit [Remote host closed the connection]
zetef has joined #commonlisp
jonatack has quit [Read error: Connection reset by peer]
jon_atack has joined #commonlisp
Alfr has quit [Server closed connection]
Alfr has joined #commonlisp
danse-nr3 has joined #commonlisp
bjorkintosh has joined #commonlisp
bjorkintosh has joined #commonlisp
bjorkintosh has quit [Changing host]
lucasta has quit [Quit: Leaving]
bjorkintosh has quit [Ping timeout: 260 seconds]
bjorkintosh has joined #commonlisp
kevingal_ has quit [Ping timeout: 260 seconds]
kevingal has quit [Ping timeout: 260 seconds]
dnhester26 has quit [Remote host closed the connection]
notzmv has quit [Ping timeout: 264 seconds]
terrorjack has quit [Server closed connection]
terrorjack has joined #commonlisp
Inline has quit [Quit: Leaving]
thuna` has joined #commonlisp
<jdz>
Not that these things cannot be done. Witness Sweden's switch to right hand traffic, which happened in 1967 (https://en.wikipedia.org/wiki/Dagen_H).
<beach>
Yes, I was there. And at the first turn, I was on the wrong side of the street. :) I was only 12 years old, so this was on a bicycle.
<bjorkintosh>
beach, you witnessed a historical system update?!
<beach>
Totally!
<bjorkintosh>
hahaha. that's cool.
HamzaShahid has left #commonlisp [ERC 5.6-git (IRC client for GNU Emacs 30.0.50)]
rgherdt_ has joined #commonlisp
triffid has quit [Remote host closed the connection]
triffid has joined #commonlisp
HamzaShahid has joined #commonlisp
<HamzaShahid>
Hello again!
<HamzaShahid>
So after creating threads which sleep for some time, essentially acting as a timer, how do I make threads run after after the other wihout using a whole core to check if the timer/thread has ended?
rgherdt has quit [Ping timeout: 252 seconds]
rgherdt__ has joined #commonlisp
<HamzaShahid>
Basically, How do I start a second thread as soon as the first one has ended/joined/is destroyed?
dnhester26 has joined #commonlisp
varjag has quit [Quit: ERC (IRC client for Emacs 27.1)]
rgherdt_ has quit [Ping timeout: 240 seconds]
rgherdt__ has quit [Remote host closed the connection]
rgherdt__ has joined #commonlisp
<flip214>
HamzaShahid: can you put an unwind-protect in the first thread that unlocks (or schedules) the next one?
<flip214>
HamzaShahid: alternatively, on linux pidfd might be a clean way to wait for uncooperative threads
<Shinmera>
or you just only have one thread that does everything. once it has done one task, it just waits until a new one arrives, or goes to the next one immediately
<HamzaShahid>
Oh yeah! thanks a lot. Just make that one thread loop! :facepalm:
waleee has joined #commonlisp
danse-nr3 has quit [Ping timeout: 260 seconds]
rgherdt__ is now known as rgherdt
<larix1>
also bordeaux-threads has condition-notify and condition-wait which you might want to look into, a waiting thread will not work until notified
<Shinmera>
again, courier's task runner does all this and should be copy-pastable.
danse-nr3 has joined #commonlisp
Inline has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
bendersteed has quit [Quit: bendersteed]
<HamzaShahid>
Shinmera, the thing is, it uses a full core where I do not have that luxury.
<HamzaShahid>
by checking with loop constantly
contrapunctus has left #commonlisp [#commonlisp]
rgherdt has quit [Ping timeout: 264 seconds]
rgherdt has joined #commonlisp
<Shinmera>
no it does not
<Shinmera>
like, it's patently false, so idk why you're saying that
easye has joined #commonlisp
danse-nr3 has quit [Read error: Connection reset by peer]
contrapunctus has joined #commonlisp
CO2 has quit [Quit: WeeChat 4.1.1]
danse-nr3 has joined #commonlisp
White_Flame has quit [Server closed connection]
White_Flame has joined #commonlisp
danse-nr3 has quit [Read error: Connection reset by peer]
<dnhester26>
I got the text from the python tutorial as a starting point for what to do, but obviously we would have to make it based on Common Lisp, this was just because sometimes it's easier to have an example in place...
justache has quit [Remote host closed the connection]
zetef has quit [Ping timeout: 246 seconds]
justache has joined #commonlisp
<HamzaShahid>
Shinmera: Oh yes, I apologize. You set up a queue with the actions but my approach since my use-case was so simple: (bt:make-thread (lambda () (dotimes (round 10) (sleep 10) (do-cool-stuff))))
<HamzaShahid>
so I just slept for 10 seconds 10 times and at the end did cool stuff
yitzi has quit [Remote host closed the connection]
CO2 has joined #commonlisp
dnhester26 has joined #commonlisp
justache is now known as justThanks
m5zs7k has quit [Ping timeout: 255 seconds]
Gleefre has joined #commonlisp
m5zs7k has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
dnhester26 has joined #commonlisp
pve has quit [Read error: Connection reset by peer]
pve has joined #commonlisp
yitzi has joined #commonlisp
Guest63 has joined #commonlisp
Renfield has quit [Server closed connection]
Renfield has joined #commonlisp
dino_tutter has quit [Ping timeout: 240 seconds]
igemnace has quit [Read error: Connection reset by peer]
amb007 has quit [Ping timeout: 255 seconds]
amb007 has joined #commonlisp
luis has quit [Ping timeout: 252 seconds]
amb007 has quit [Read error: Connection reset by peer]
amb007 has joined #commonlisp
mgl_ has quit [Ping timeout: 264 seconds]
tyson2 has quit [Remote host closed the connection]
semarie has quit [Ping timeout: 252 seconds]
igemnace has joined #commonlisp
semarie has joined #commonlisp
mgl_ has joined #commonlisp
cage has joined #commonlisp
green__ has joined #commonlisp
dnhester26 has quit [Remote host closed the connection]
green_ has quit [Read error: Connection reset by peer]