Mercurial > urweb
comparison src/c/urweb.c @ 1514:3c0803c1acd7
Backpedal on tutorial-motivated urweb-mode changes; add Basis.diffInSeconds and Basis.toSeconds
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 22 Jul 2011 15:39:38 -0400 |
parents | dcc8abbc6dfd |
children | 5175bed443f9 |
comparison
equal
deleted
inserted
replaced
1513:5616b2cbdcdb | 1514:3c0803c1acd7 |
---|---|
3662 uw_Basis_time uw_Basis_addSeconds(uw_context ctx, uw_Basis_time tm, uw_Basis_int n) { | 3662 uw_Basis_time uw_Basis_addSeconds(uw_context ctx, uw_Basis_time tm, uw_Basis_int n) { |
3663 tm.seconds += n; | 3663 tm.seconds += n; |
3664 return tm; | 3664 return tm; |
3665 } | 3665 } |
3666 | 3666 |
3667 uw_Basis_int uw_Basis_diffInSeconds(uw_context ctx, uw_Basis_time tm1, uw_Basis_time tm2) { | |
3668 return difftime(tm2.seconds, tm1.seconds); | |
3669 } | |
3670 | |
3671 uw_Basis_int uw_Basis_toSeconds(uw_context ctx, uw_Basis_time tm) { | |
3672 return tm.seconds; | |
3673 } | |
3674 | |
3667 void *uw_get_global(uw_context ctx, char *name) { | 3675 void *uw_get_global(uw_context ctx, char *name) { |
3668 int i; | 3676 int i; |
3669 | 3677 |
3670 for (i = 0; i < ctx->n_globals; ++i) | 3678 for (i = 0; i < ctx->n_globals; ++i) |
3671 if (!strcmp(name, ctx->globals[i].name)) | 3679 if (!strcmp(name, ctx->globals[i].name)) |