File tree Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Expand file tree Collapse file tree 4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ const std = @import ("std" );
2
+
3
+ pub fn build (b : * std.Build ) void {
4
+ const target = b .standardTargetOptions (.{});
5
+ const optimize = b .standardOptimizeOption (.{});
6
+
7
+ const exe = b .addExecutable (.{
8
+ .name = "package_manager" ,
9
+ .root_source_file = b .path ("src/main.zig" ),
10
+ .target = target ,
11
+ .optimize = optimize ,
12
+ });
13
+ b .installArtifact (exe );
14
+
15
+ const run_cmd = b .addRunArtifact (exe );
16
+ run_cmd .step .dependOn (b .getInstallStep ());
17
+ if (b .args ) | args | {
18
+ run_cmd .addArgs (args );
19
+ }
20
+
21
+ const run_step = b .step ("run" , "Run the app" );
22
+ run_step .dependOn (& run_cmd .step );
23
+
24
+ const exe_unit_tests = b .addTest (.{
25
+ .root_source_file = b .path ("src/main.zig" ),
26
+ .target = target ,
27
+ .optimize = optimize ,
28
+ });
29
+ const run_exe_unit_tests = b .addRunArtifact (exe_unit_tests );
30
+
31
+ const test_step = b .step ("test" , "Run unit tests" );
32
+ test_step .dependOn (& run_exe_unit_tests .step );
33
+
34
+ // Import package
35
+ const zul = b .dependency ("zul" , .{
36
+ .target = target ,
37
+ .optimize = optimize ,
38
+ });
39
+ exe .root_module .addImport ("zul" , zul .module ("zul" ));
40
+ }
Original file line number Diff line number Diff line change
1
+ .{
2
+ .name = "package_manager" ,
3
+ .version = "0.0.0" ,
4
+ .dependencies = .{
5
+ .zul = .{
6
+ .url = "https://github.com/karlseguin/zul/archive/master.tar.gz" ,
7
+ .hash = "12206f5d1e5bd4793fe952bbae891b7424a19026e0d296a1381074c7d21d5d76c1a1" ,
8
+ },
9
+ },
10
+ .paths = .{
11
+ "build.zig" ,
12
+ "build.zig.zon" ,
13
+ "src" ,
14
+ },
15
+ }
Original file line number Diff line number Diff line change
1
+ # Package Manager
2
+
3
+ For example, using the [ karlseguin/zul] ( https://github.com/karlseguin/zul ) package.
4
+
5
+ ``` bash
6
+ $ zig build run
7
+ UNIX: 1857079750000
8
+ GMT: 2028-11-05T23:29:10Z
9
+ Convert UNIX timestamp to human readable: https://www.unixtimestamp.com
10
+ ```
Original file line number Diff line number Diff line change
1
+ const std = @import ("std" );
2
+ const zul = @import ("zul" ); // https://github.com/karlseguin/zul
3
+
4
+ pub fn main () ! void {
5
+ const dt = try zul .DateTime .parse ("2028-11-05T23:29:10Z" , .rfc3339 );
6
+ const unix = dt .unix (.milliseconds );
7
+ std .debug .print ("UNIX: {d}\n GMT: {s}\n " , .{ unix , dt });
8
+ std .debug .print ("Convert UNIX timestamp to human readable: https://www.unixtimestamp.com" , .{});
9
+ }
You can’t perform that action at this time.
0 commit comments