Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Timestamp a special SATS type #1836

Merged
merged 36 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
dece63c
WIP: Make `Timestamp` a special SATS type
gefjon Oct 10, 2024
998db08
Restore `Timestamp` to user-facing status
gefjon Oct 11, 2024
1a6566a
Clippy
gefjon Oct 11, 2024
9ecc60f
Fix Rust smoketests; offer backcompat methods
gefjon Oct 14, 2024
75a664e
Update TypeScript codegen to use new `Timestamp` class
gefjon Oct 16, 2024
9571e0e
Also add `TimeDuration`, which is like `Duration`
gefjon Oct 17, 2024
75ae9d9
Merge branch 'master' into phoebe/timestamp-special-type
gefjon Oct 21, 2024
5c64b9a
fmt
gefjon Oct 21, 2024
2934b59
Update WebSocket schema to use `TimeDuration`
gefjon Oct 21, 2024
ae88395
Implement Timestamp and TimeDuration in C#
kazimuth Oct 15, 2024
627c35b
Become more special
kazimuth Oct 23, 2024
36bb5bd
Consistent formatting for Timestamp and TimeDuration (please bikeshed)
kazimuth Oct 23, 2024
072c2ea
Prioritize BSATN and BFLATN compat with 0.12
gefjon Oct 30, 2024
8d9715c
Merge branch 'master' into phoebe/timestamp-special-type
kazimuth Nov 22, 2024
c50cbba
Fix extant compile error
kazimuth Nov 22, 2024
22a7355
Fix type error
kazimuth Nov 22, 2024
436cb73
Fix conflicts
kazimuth Nov 22, 2024
436c776
Merge branch 'master' into phoebe/timestamp-special-type
gefjon Jan 24, 2025
4b89003
Rework Timestamp declarations in BSATN.Runtime
kazimuth Jan 29, 2025
5f4c3aa
Start fixing sdk-test, whoops
kazimuth Jan 29, 2025
ffeadfa
Remove outdated API from tests
kazimuth Jan 30, 2025
cb81c9b
Better comments
kazimuth Feb 3, 2025
1cddd58
Merge remote-tracking branch 'origin/master' into phoebe/timestamp-sp…
gefjon Feb 4, 2025
c7c8de5
Fix smoketests
gefjon Feb 4, 2025
fe9998c
format c#
gefjon Feb 4, 2025
2950991
use timestamp in c# benchmark modules
gefjon Feb 4, 2025
dfb0e93
Apply James' suggestions
gefjon Feb 6, 2025
9f469e5
Merge remote-tracking branch 'origin/master' into phoebe/timestamp-sp…
gefjon Feb 6, 2025
0b99e1c
Merge branch 'master' into phoebe/timestamp-special-type
kazimuth Feb 6, 2025
7e12c3e
Allow adding TimeDurations to Timestamps similar to std API
kazimuth Feb 6, 2025
596a10c
Add rest of Timestamp functions to C# and purge DateTimeOffset
kazimuth Feb 6, 2025
d0b210e
Teach CLI about mysterious tildes that sometimes appear in C# bin fol…
kazimuth Feb 6, 2025
f50f238
Merge remote-tracking branch 'origin/master' into phoebe/timestamp-sp…
gefjon Feb 7, 2025
aa7abdc
Dotnet format
kazimuth Feb 7, 2025
46ee2ea
Try formatting with `dotnet csharpier` instead?
gefjon Feb 7, 2025
48b47ce
Add comment re: `bin/` and `bin~/`
gefjon Feb 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions crates/bindings-csharp/BSATN.Runtime.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,28 @@ public static void NonHexStrings()
[Fact]
public static void TimestampConversionChecks()
{
ulong us = 1737582793990639;
var time = ScheduleAt.DateTimeOffsetFromMicrosSinceUnixEpoch(us);
var us = 1737582793990639L;

var time = ScheduleAt.DateTimeOffsetFromMicrosSinceUnixEpoch(us);
Assert.Equal(ScheduleAt.ToMicrosecondsSinceUnixEpoch(time), us);

var interval = ScheduleAt.TimeSpanFromMicroseconds(us);
Assert.Equal(ScheduleAt.ToMicroseconds(interval), us);

var stamp = new Timestamp(us);
var dto = (DateTimeOffset)stamp;
var stamp_ = (Timestamp)dto;
Assert.Equal(stamp, stamp_);

var duration = new TimeDuration(us);
var timespan = (TimeSpan)duration;
var duration_ = (TimeDuration)timespan;
Assert.Equal(duration, duration_);

var newIntervalUs = 333L;
var newInterval = new TimeDuration(newIntervalUs);
var laterStamp = stamp + newInterval;
Assert.Equal(laterStamp.MicrosecondsSinceUnixEpoch, us + newIntervalUs);
Assert.Equal(laterStamp.TimeDurationSince(stamp), newInterval);
}
}
2 changes: 2 additions & 0 deletions crates/bindings-csharp/BSATN.Runtime/BSATN.Runtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<!-- Note: the binary produced by this package is used in Unity too, which is limited to .NET Standard 2.1. -->
<TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>
<RootNamespace>SpacetimeDB</RootNamespace>
<!-- You can enable this when debugging codegen problems. Outputs in obj/debug/[version]/generated. -->
<!-- <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> -->
</PropertyGroup>

<ItemGroup>
Expand Down
Loading